开发者

libevent and epoll,which is more efficient? [closed]

开发者 https://www.devze.com 2023-03-08 09:31 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I think these are the two eve开发者_如何学JAVAnt-dealing libraries among the best.

These two both have many users,but which is better?


epoll is offered by Linux. libevent is built on top of epoll. Using epoll alone may thus be more efficient, if you know what you're doing.


As mentioned by blais, libevent uses epoll internally. Libev (http://software.schmorp.de/pkg/libev.html) is also a good choice (I feel it is better than libevent, but that is just me). As for me, I've used epoll directly in some projects and libev in other projects. I like libev because it also provides timers, signals, periodic timers (cron-like), and stat watchers.

So, which is better? If you want to watch a few socket descriptors then epoll is probably all you need. If you are writing a multi-threaded application then libevent/libev would probably be a better way to go. I don't think you'll see an appreciable speed difference between epoll and libevent/libev.

0

精彩评论

暂无评论...
验证码 换一张
取 消