|
Hi
I just downloaded and built Lua 5.3 work3. I built it on Win7 using visual studio 2008. It built OK with just a few minor warnings, I thought I would test the speed up due to the introduction of integer types. So using the VS2008 Release build, I tested this script. local startTime, endTime startTime = os.clock() for i=0, 10000 do for j=0, 100000 do local x = i*j end end endTime = os.clock() print(string.format("Time = %3.3f Secs", endTime-startTime) ) I haven't studied where the integer changes come into play with Lua 5.3, but I assumed a couple of nested for loops would be an obvious place, as I thought it would likely use ints for the 10,000 loops and I would get a measurable speed up from Lua 5.1 that used 8 byte doubles for those I,j loop variables. Here are the numbers I got Running from Scite -->Lua 5.1 : Time = 9.639 Secs Running from Dos Console--> Lua 5.1 : Time = 10.412 Secs Running from Dos Console--> Lua 5.3 : Time = 15.236 Secs So I am seeing a 50% slow going from 5.1 to 5.3, very surprising ? Maybe VS2008 default build setting is poor compared to whatever compiler the Lua 5.1 exe distributable was built with ? (gcc/Intel or whatever) So as a further experiment I changed the script to have non integer loops for I=0.1, 10000.1 do in an effort to make Lua 5.3 revert back to doubles if it was really using ints before. As expected for both the Lua 5.1 tests, it made little difference to the measured times, (it is using doubles so 0.1 is as efficient as using 0 in the first test) OK so repeated the 0.1 test with Lua 5.3 Running from Dos Console--> Lua 5.3 : Time = 11.965 Secs. Instead of the anticipated slowdown I got a speed up ? What the heck is going on here ? These numbers made my head hurt, can anyone repeat or even explain these numbers with Lua 5.3 ? Thanks for any responses Regards Geoff |