lua-users home
lua-l archive

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


 FYI.  This is a comparison of the array test from the language shootout run
on my P4 2.8GHz with 1GB of memory.  The code:

function array_test( n )

	local x, y = {}, {}

	for i=1,n do
		x[i] = i
		y[i] = 0
	end

	for k=1,1000 do
		for j=n,1,-1 do
			y[j] = y[j] + x[j]
		end
	end

	return y[1] .. " " .. y[n]
end

I wrapped it with os.clock() calls and got these results:

Lua 5.0.2
  1000 - 0.312s
  3000 - 0.891s
  5000 - 1.515s
  7000 - 2.11s

Lua 5.1 (work2)
  1000 - 0.343s
  3000 - 1.032s
  5000 - 1.718s
  7000 - 2.407s

This is as compiled on VC++ .NET 2003.  Looking at my old tests it seems
like 5.0.2 compiled with VC++ 6 is faster at less than .3s for n=1000.  I
need to reinstall 6 and check this again to be sure, but has anyone else
noticed this?

  Tom Spilman
  Co-owner | Programmer
  www.sickheadgames.com