lua-users home
lua-l archive

Re: ... efficiency (was Re: class implementation)

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Apr 06, 2006, at 02:40, Mark Hamburg wrote:
Performance with ... Is a mixed bag.
Mike is correct that introducing the iterator function -- even as useful as it is -- brings in memory allocation costs and hence is a lose for small
numbers of arguments.
My concern is that the standard idioms for iterating over varargs have
essentially quadratic time complexity and that's basically a problem waiting
to happen.
I had the same syntactic though as you a few days ago, that # ... should return the length. Of course, I would never suggest such syntactic sugar on the list. I hadn't realised that using select would lead to quadratic iteration until you pointed it out, but of course your're right. That's not good.
"for k,v in pairs{...}" is not quadratic, but it isn't fast.
drj

AltStyle によって変換されたページ (->オリジナル) /