rwaldron / temporal

Non-blocking, temporal task sequencing. For use with robots built with Johnny-Five
http://johnny-five.io/
MIT License
84 stars 12 forks source link

Take a huge CPU load #9

Closed mdehaussy closed 10 years ago

mdehaussy commented 10 years ago

Main loop is called every tick. On small hardware config (like celeron), it takes 100% of CPU.

rwaldron commented 10 years ago

Yep, I've seen this before on Raspberry Pi as well. Hopefully you won't judge me too harshly, but I can only give the same explanation that I gave for #6 :(

I've considered mechanisms that look at the queue registry and if there is nothing there, don't call setImmediate again, this would require some very minor refactoring to allow restarting the setImmediate loop. Restart is called whenever any new tasks are created.

Do you have any insights? I'm open to exploring different approaches.