3 ms·
>is actually faster than Node.js Uhhh I call BS until proven otherwise. Maybe the event loop is faster, but I'm willing to bet the callback code is slower.
by omginternets 10y ago
>is actually faster than Node.js
Uhhh I call BS until proven otherwise. Maybe the event loop is faster, but I'm willing to bet the callback code is slower.
- nicoburns 10y ago> Maybe the event loop is faster, but I'm willing to bet the callback code is slower. This is exactly the case, and the slowdown is pretty noticeable IMO. Still, python 3 is a whole lot better at this than python 2.
- xapata 10y agoDepends on many things. What task are you trying to accomplish?
- omginternets 10y agoIn any non-contrived example, CPython's callback code will be slower than equivalent JIT-ed code from v8. Please don't play the "it depends" card just to be smug. It lowers the level of discourse.
- xapata 10y agoI ain't being smug. If I were, I might use fancy words like "discourse". But we're not playing cards here, are we? JIT-ed code can be pretty fast, but so can calls to libraries like NumPy. PyPy can also be somewhat speedy, though it hasn't had as much dev time as v8. And if you somehow find yourself breaking new ground with an algorithm no one's written a fast implementation of yet, there's always Cython. Besides, if there's any task that takes more than a negligible amount of time, I usually push it to a different process and respond immediately. The callback speed in that case is bound by the time it takes to write to a message queue or append to a database table, not the language itself.
- tuco86 10y agothe callback code being slower is actually a feature in my opinion.. http://stackoverflow.com/questions/18542484/why-callbacks-are-ugly http://stackoverflow.com/questions/18542484/why-callbacks-ar...
- omginternets 10y agoI'm struggling to see where in the wall of text this notion is supported. This smells of mental gymnastics. I'm a huge fan of python (though I much prefer twisted to aio), but slower callbacks are unequivocally worse than faster ones, all other things being equal (which of course, they never are).
- elnygren 10y agoThe "proof" (benchmarks, yeah, I know) is in the provided link. Feel free to shoot them down. Anyway, slower or not, writing a small async service is still easier in Node.js. You can trust that no libraries block your event loop and I'm not sure there's quite anything like Express (simplicity+popularity) for async Python just yet.
- omginternets 10y ago>The "proof" (benchmarks, yeah, I know) is in the provided link. Feel free to shoot them down. I just did: those benchmarks show uvloop's performance, not python's, i.e.: they're designed to minimize time spent in callback code.