lua-users home
lua-l archive

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


Hi all,

Triggered by a message on this list I picked up an old todo item still lingering around. I tried to test the impact of corowatch [1] (that is using a debug hook that is set to run every 10000 vm instructions) over a coroutine without it.

When I run the tests, the outcome differs per run, too much imo, so I probably am doing something wrong. Quite regularly the debug version runs faster...
So I updated the functions with everything I could think of that might have caused it, but to no avail;
- wrote two identical test functions, 1 with, 1 without and measured them
- then added a 'warm up' section
- then disabled GC
- then removed a table to store the results to further minimize GC impact
- then added a 10 run average
- then... posted this message because I ran out of ideas

So any ideas as to what (silliness) I'm missing?

This may not help much, but: I didn't have luasocket handy, so I used os.clock() for coroutine.gettime (on Windows, so it's not the CPU time, but time in floating point seconds since program start, and since in this case we only need relative times it should do). Running it in Lua 5.2.2, over 10 runs the delta has been consistently in [-1,1]%, mostly 0%. So a wild guess: maybe the results you see have something to do with how luasocket measures time?

Thijs

Florian

[1] https://github.com/Tieske/corowatch