Re: Microlight
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Microlight
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: 2012年12月19日 16:52:30 -0200
> As far as I can tell, if you're using PUC Lua, then yes, a numeric for is faster than ipairs, but a while loop is even better.
On Mac OS X 10.6.8 running in an old mini, numeric for wins:
% lua -v test_ipairs.lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
while: 0.749045s, 3.3343334e+14
ipairs: 1.332448s, 3.3343334e+14
fixed-length numeric_for: 0.519153s, 3.3343334e+14
numeric_for and #: 0.518728s, 3.3343334e+14
% lua -v test_ipairs.lua
Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
while: 0.736432s, 3.3343334e+14
ipairs: 1.189561s, 3.3343334e+14
fixed-length numeric_for: 0.58731s, 3.3343334e+14
numeric_for and #: 0.58876s, 3.3343334e+14