[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: gary ng <garyng2000@...>
- Date: Mon, 11 Sep 2006 13:12:23 -0700 (PDT)
--- Sam Roberts <sroberts@bycast.com> wrote:
> > less than 25% difference... not significant
>
> Not if you do it once. If you have identified the
> time spent appending
> to tables as being significant in your app, cutting
> that time by 20%
> would be a major coup!
>
> Also, it could be more, since the #t+1 takes time,
> but if [] didn't take
> an arg, finding that would be a C pointer
> dereference internally, maybe
> this gives a feel for that, maybe not:
>
> lua5.1 -e 'local t={1,2,3,4,5} for i = 1,1e8 do
> t[#t+0]=1 end' 13.33s user 0.00s system 96% cpu
> 13.851 total
> lua5.1 -e 'local t={1,2,3,4,5} for i = 1,1e8 do
> t[5]=1 end' 9.82s user 0.02s system 91% cpu
> 10.769 total
>
Does it worth it to be part of the language just for
the 25% gain ? I would buy it if we are talking about
5x and it really is used a lot.
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com