On 6/8/10 7:21 PM, "Graham Leggett" <minf...@sharp.fm> wrote: > That said, if your server doesn't have work to do, ie > you're just a bit-shifter, then a simple async loop will win hands down.
We also found that even for "resource intensive" tasks -- like rendering a template or something similar -- it's best just to let it run so it can finish and get out of the way. Only real time it seems to make sense to "yield" is when you need to wait on IO.* Threaded programming just hides the wait because the OS takes care of the yielding for you. In Lua, I did tests using coroutines to hide yielding to an even loop, and that didn't turn out so well. The code looked awesome, but performance was horrible. *with the popularity of RESTful (or RESTish) database-like things, writing an application server using an event loop should be easier. No more blocking database clients. Ultimately, that what I want to do with the Lua. Well, that and kill mod_rewrite and the like ;) -- Brian Akins