[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: userdata environment
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 8 Sep 2009 10:37:18 +0200
2009/9/7 Juris Kalnins <email@example.com>:
> On Tue, 01 Sep 2009 17:20:48 +0300, Jerome Vuarand
> <firstname.lastname@example.org> wrote:
>> When I first used userdata environment I assumed it was the case and
>> was quite disappointed to discover it's not.
>> However you have other methods to associate metadata to a userdata.
>> For example you can use a weak table in the registry, with the
>> userdata as a weak key and the string as value.
> Thanks. This indeed is probably the best one can do now. But doing this
> spoils the "convenience feature for programmers" part. And it is MUCH
> slower than accessing value through a direct pointer.
Feel free to provide the benchmark results next time you talk about
performance here, many people will simply ignore your comments
otherwise (I assume you benchmarked that thing, otherwise you would
have no way to predict it's "MUCH slower").
> Basically my question is whether any code other than the lua_setfenv and
> lua_getfenv depend on
> Udata->env being a (Table *)? If adding dozen lines to the core means I
> don't have to
> create extra table, and it doesn't break anything, I think it's worth doing.
A dozen lines for every small feature, and in the end you get a
multi-gigabyte bloatware. I guess the authors have to plainly ignore
some feature request to keep Lua small.