[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Puzzled by simple test with Lua 5.3
- From: Eric Wing <ewmailing@...>
- Date: Mon, 14 Jul 2014 11:42:59 -0700
On 7/12/14, Geoff Smith <spammealot1@live.co.uk> wrote:
> 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
>
As another data point, I ran the above script on an iMac with an Intel
i3, 3.2GHz under 10.9 using Lua 5.2.3 and 5.3 work 3. Best times out
of 10 attempts:
Lua 5.2.3: 12.824 Secs
Lua 5.3 work 3: 13.943 Secs
Compiled Lua with clang:
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Used -Os optimization level.
I did see that Lua 5.2 usually edged out 5.3.
Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/