Live data from Hacker News

Ask HN: Event loop vs. Threads

news.ycombinator.com

11–20 of 36 posts

Re: Ask HN: Event loop vs. Threads

#11

Hi, I work at a company that makes heavy use of event loops. I'll try to accurately convey what I know: From an efficiency standpoint, using event loops requires much less memory, but marginally more CPU time than threaded approaches. In terms of maintenance, you're essentially writing your programs in continuation passing style which means error handling is explicit everywhere. There are tools that allow you to hide…

At high concurrency, I'd argue you will probably end up being more cpu efficient as well. The cost of context switching effectively larger frames and getting into and out of privileged mode can get expensive.

Re: Ask HN: Event loop vs. Threads

#14
post #9

Thought this was the definitive blog post on the issue: http://sheddingbikes.com/posts/1280829388.html "epoll is faster than poll when the active/total FD ratio is 0.6."

Really not sure, why someone voted this down? The only open experiments on the issue of threads vs. events - at least I don't know of any other.

Re: Ask HN: Event loop vs. Threads

#15
If one of my developers posted something like this, I would fire them on the spot.

You've got a "lot of legacy C++ code", and it seems like you're just randomly deciding whether or not to port it. You're basing this decision not on measurement, team considerations, or the needs of your project. Instead you're soliciting opinions from random people on the internet on what is a very religious issue.

If you have problems with your code (performance, maintainability, debugging, whatever), then go fix that. Maybe switching to Node is the right thing to do. But you'd be a fool to make that decision based on something someone said on Hacker News.

Re: Ask HN: Event loop vs. Threads

#16

If one of my developers posted something like this, I would fire them on the spot. You've got a "lot of legacy C++ code", and it seems like you're just randomly deciding whether or not to port it. You're basing this decision not on measurement, team considerations, or the needs of your project. Instead you're soliciting opinions from random people on the internet on what is a very religious issue. If you have problem…

Why be so negative? At least he or his team is taking some initiatives.

Re: Ask HN: Event loop vs. Threads

#17

If one of my developers posted something like this, I would fire them on the spot. You've got a "lot of legacy C++ code", and it seems like you're just randomly deciding whether or not to port it. You're basing this decision not on measurement, team considerations, or the needs of your project. Instead you're soliciting opinions from random people on the internet on what is a very religious issue. If you have problem…

Funny, that almost all the programmers I know posted questions at one time or other on stackoverflow or codeproject. Do you mean to say all these guys taking opinions from strangers need to be fired ?

Re: Ask HN: Event loop vs. Threads

#18

Most developers with no background in electroncis do not understand asynchronuous paradigm : Transitions = factorial(state). In best case if they don't confuse states and transitions (wich is common) you'll end up with a spaghetti code where goto are replaced with callbacks on events. In common case they will make intricated state models without making the docs (state transition diagrams are a MUST have (like RFCs on…

> Transitions = factorial(state). In best case if they don't confuse states and transitions (wich is common) you'll end up with a spaghetti code where goto are replaced with callbacks on events.

Hey could you expand on this? I don't understand what you mean by transitions = factorial(state) and why this leads to spaghetti code when you confuse state and transitions.

Re: Ask HN: Event loop vs. Threads

#19

If one of my developers posted something like this, I would fire them on the spot. You've got a "lot of legacy C++ code", and it seems like you're just randomly deciding whether or not to port it. You're basing this decision not on measurement, team considerations, or the needs of your project. Instead you're soliciting opinions from random people on the internet on what is a very religious issue. If you have problem…

That's a bit unfair.

The OP uses the word "we" implying some sort of team decision. And asks for references, implying this is still under research.

Re: Ask HN: Event loop vs. Threads

#20
post #9

Thought this was the definitive blog post on the issue: http://sheddingbikes.com/posts/1280829388.html "epoll is faster than poll when the active/total FD ratio is 0.6."

Really not sure, why someone voted this down? The only open experiments on the issue of threads vs. events - at least I don't know of any other.

That has nothing to do with threads vs events at all. It is Zed going "I am going to make up some imaginary fallacies about poll and epoll and then prove them wrong, by proving epoll does exactly what it says it does". These are both ways of checking file descriptors for activity, which says nothing about threads vs event loops vs cps.
Post reply on HN