Replace libevent dependency with embedded libev#96
Conversation
1 similar comment
1 similar comment
|
Would you be willing to elaborate the advantages of |
|
Hi @jonasschnelli , The main advantage is the ease with which libev can be embedded, removing yet another libccoin dependency. libev is much smaller than libevent and if the benchmark results are the be believed libev is more efficient. This stackoverflow link explains some of the advantages of libev over libevent: libev may be a suitable solution for libbtc also, but on a separate issue have you seen a previous pull request #95? I see that you were considering writing a libfortunaprng library. Is any of the code used in #95 of use to you? It is based on a Postgres implementation of Fortuna and is a minimized (possibly improved) version of libfortuna (also based on Postgres). Maybe some of this code could be reused in libbtc. |
|
@aido Thanks for the great explanation. fortuna: What I'd like to do is porting the Core PR above to C to |
|
The http stuff from libevent already caused much pain (through limitations) in Bitcoin Core, so I would prefer to avoid that again; prefer to just use the base event layer. I'm agnostic on the base layer - libevent or libev - not really thrilled about including a system-ish lib in the picocoin codebase. |
Yes. There are limitations. If you need high-scale httpd, it's probably the wrong tool.
I think the advantages of libevent are quite neat. Stuff like bandwidth limitation, etc. can be useful. But agree, it's another (cross)compile hassle. |
I was referring to importing a tree / adding a git subtree into the codebase. Would rather link to an external libevent or libev using the normal autoconf toolage, and avoid importing libev[ent] code directly into the picocoin build. Using libev[ent] is good, yes. Much prefer to use libevent rather than direct select/poll coding. |
It's not about scale. The HTTP connection handling is very GET-or-form-POST centric, and was written before the era of bidirectional connections, push, PUT upload and many other modern advancements. These features are then tacked on poorly. I've written several servers using libevent's http and seen this up close. libevhtp is an illustration of the many areas where libevent http falls short. https://github.com/ellzey/libevhtp |
|
@jgarzik: thanks for pointing this out. TIL. |
|
Hi, OK, there are more pros than cons to leaving libevent as is. Closing PR. |
Hi,
This pull request proposes to replace the libevent dependency with directly embedded libev.
libev comes with a libevent compatibility API to make migration easier. Not all libevent functions are available in the API so
event_new(),event_free()andevent_base_loopbreak()had to be added tonet.h. A few compiler warnings are generated but these can be ignored or removed if this pull request is acceptable.The libev developers have the following to say about compiler warnings (https://linux.die.net/man/3/ev):