On Mon, Feb 28, 2011 at 12:31 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> Reuben Thomas <
rrt@sc3d.org> writes:
> >> It's in 5.1 as well. Just not documented.
> >
> > Wow.
> >
> > No prizes for the weird format, though. What's wrong with a table?
>
> This way probably saves a good 20-30 bytes of memory... :]
Actually it is more like 500 bytes, if I did the math right (not
counting the extra C code to create the table). Given that very few
people use package.config, and those that use probably only need its
first character, it does not look that cheap to me.
-- Roberto
Thanks for sweating these details. I understand that many of your users may never go outside of the infinite memory model popular in desktop programming, but some of us embedded programmers are trying to use Lua with 64kB or less of RAM, so those 500 bytes make a big difference!
I do have to make some modifications to fit in my constrained environment, but these sensible valuations are much appreciated. I won't be closed-minded and advocate saving memory at the expense of speed or legibility everywhere, but I appreciate that you take the time to make sensible trade-offs like this one.
Thanks!
--
Kevin Vermeer