lua-users home
lua-l archive

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


> 
> It is really weird. I also got similar result running your code.
> After some exploring, I think I have got some points, but not quit clear.
> 
> Well, although I don't know why, some experiments shows that the *main
> thread* runs
> slower than *user created thread(coroutines)*.
> 
> Please someone would tell me the deep reason for that?
> 

Thanks for trying that and the hint, I get different results though;
- coroutines consistently slower than the mainloop
- corowatch (using debug hooks) consistently runs fastest

Attached my code. Here's the output;
C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.28079986572266
Coroutine:      0.27924041748047
Corowatch:      0.2574010848999
corowatch is -8% slower than unprotected
coroutine is 0% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.28079986572266
Coroutine:      0.28704032897949
Corowatch:      0.26520118713379
corowatch is -8% slower than unprotected
coroutine is -3% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.26832046508789
Coroutine:      0.28080024719238
Corowatch:      0.26052074432373
corowatch is -8% slower than unprotected
coroutine is -5% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.27924003601074
Coroutine:      0.28391990661621
Corowatch:      0.26988162994385
corowatch is -5% slower than unprotected
coroutine is -2% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.27923984527588
Coroutine:      0.29015998840332
Corowatch:      0.27144165039063
corowatch is -7% slower than unprotected
coroutine is -4% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.2683198928833
Coroutine:      0.2808012008667
Corowatch:      0.26520023345947
corowatch is -6% slower than unprotected
coroutine is -5% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.2776798248291
Coroutine:      0.2854808807373
Corowatch:      0.26988067626953
corowatch is -6% slower than unprotected
coroutine is -3% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.27923984527588
Coroutine:      0.28860111236572
Corowatch:      0.26988048553467
corowatch is -7% slower than unprotected
coroutine is -4% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>performance.lua
Mainloop :      0.28080158233643
Coroutine:      0.28547992706299
Corowatch:      0.26987991333008
corowatch is -6% slower than unprotected
coroutine is -2% faster than the main loop

C:\Users\Thijs\Dropbox\Lua projects\corowatch\examples>

Attachment: performance.lua
Description: performance.lua