lua-users home
lua-l archive

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


> You've probably forgotten to disable the power-saving features of
> your CPU/OS. The runtimes are quite short, so this is running at a
> fraction of the CPU frequency for the first part and then at full
> speed towards the end of each run. The delay until the CPU goes
> full speed is more or less random or depends on unrelated things
> (e.g. more system-calls due to memory allocation from
> coroutine.create).

This isn't a personal machine, so I can't change the power saving settings. Why would "local x" cause more memory allocation for coroutine creation?

> Umm, what is running slower than what? The loop runs at exactly
> the same speed as a C version (using doubles).

The gcc version is slower. Probably this is just a quirk of this machine.

> BTW: Please don't call this a benchmark or try to infer anything
> from it. It's a trivial loop and has zero practical significance.

Fair enough.

Peter


On Sat, Jul 3, 2010 at 4:09 AM, Mike Pall <mikelu-1007@mike.de> wrote:
Peter Jin wrote:
> I'm curious as to what might be causing the difference in runtimes. Please
> see the comments below. As indicated, declaring "x" as local causes
> somewhere between 1.5-1.8 times slow down for the coroutine loop compared to
> the function calls, whereas they have nearly identical times otherwise. I am
> running this on an AMD Phenom II X4 920 machine, with the latest LuaJIT 2.0
> source from the development branch. Am I missing something something obvious
> about LuaJIT coroutines that explains this?

All variants are the exact same speed on my CPU.

You've probably forgotten to disable the power-saving features of
your CPU/OS. The runtimes are quite short, so this is running at a
fraction of the CPU frequency for the first part and then at full
speed towards the end of each run. The delay until the CPU goes
full speed is more or less random or depends on unrelated things
(e.g. more system-calls due to memory allocation from
coroutine.create).

I suggest to read the "Measurement Methods" section in:
 http://luajit.org/performance.html

> FYI I should add that, using gcc -O2 -msse2 etc., the plain C version of
> loopy() performs 1.5x slower using int, and 3x slower using double.

Umm, what is running slower than what? The loop runs at exactly
the same speed as a C version (using doubles).

BTW: Please don't call this a benchmark or try to infer anything
from it. It's a trivial loop and has zero practical significance.

--Mike