[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Another attempt at SpeedingUpStrings
- From: Asko Kauppi <askok@...>
- Date: Tue, 18 Dec 2007 14:42:27 +0200
Javier Guerra kirjoitti 17.12.2007 kello 23:03:
On 12/17/07, Luiz Henrique de Figueiredo <email@example.com>
using pushstring() feels unoptimal.
That's the problem: it *feels* unoptimal but in reality, as Rici
it does not make any actual difference, not enough to warrant a
error-prone, ugly API...
Yet another lesson at the wrong perceptions that we programmers
i really want to agree; and of course it warrants a benchmark or two.
but still, using string constants in Lua is (almost?) as light as
using integers, and i'd like to have this from C; ideally using enums
that get translated to already-interned lua strings.
unfortunately, i don't believe there's a neat solution.
You can push all the strings in startup on the registry, with light
userdata pointers (of the C side string constant) serving as keys.
This will turn string pushing into a table lookup instead; maybe no
better at all?