On 18-12-2010 2:06, Philipp Gesang wrote:
What always baffled me is that in the manual Roberto advertises ipairs() as the iterator of choice (at least in the v.5.0 doc). Compared to the other options using it is just, well, erratic.
I did lots of testing (an doptimizing) in critical code but in practice one will not notice much difference in a mkiv run. Actually, I changed all pairs, ipairs as there was a temporary intention to remove them from the lua core. btw, in for i=1,#t do ... the #t is also a function call (so having many in these t[#t+1] = ... cases is also slower but again, seldom noticeable as lua in general is so fast a similar dicussion can be held for strings being hashed but again the penalty is neglectable esp if one takes into account that strings only have one instance and compare real fast (pointer comparison); in mkiv / luatex we have lots of strings (keys, identical values, etc) and it really pays off to have them hashed Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------