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

2

9

I think these are the two event-dealing libraries among the best.

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

Rojas answered 25/5, 2011 at 5:49 Comment(0)
Z
7

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.

Zoon answered 26/5, 2011 at 13:33 Comment(1)
Yep and libev also uses epoll() has backend (when epoll() is available, else libev uses poll() or select()).Packing
S
7

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.

Sancho answered 12/6, 2011 at 7:8 Comment(2)
According to this, libev is a bit faster than libevent. libev.schmorp.de/bench.htmlFoch
Probably should have stated that choosing between epoll and libev has also to do with the platform one is targetting -- epoll is only available in Linux kernel, not on BSD or anything else.Figment

© 2022 - 2024 — McMap. All rights reserved.