Why was libev/libuv created instead of use another simliar library?

10,255 views
Skip to first unread message

Fredrik O

unread,
Apr 4, 2013, 5:11:22 PM4/4/13
to nod...@googlegroups.com
When node.js was created, why was it essential to create a new library to run background (asynchronous) jobs? What was to example wrong with boost.asio or libevent? If some functionality was needed should it well be more easy to extend those libraries than to create a new library, from scratch?

What was the primary reason for creating libev/libuv?

Thanks in advance!

Nikhil Marathe

unread,
Apr 4, 2013, 5:26:57 PM4/4/13
to nod...@googlegroups.com
On Thu, Apr 4, 2013 at 2:11 PM, Fredrik O <evo...@gmail.com> wrote:
When node.js was created, why was it essential to create a new library to run background (asynchronous) jobs? What was to example wrong with boost.asio or libevent? If some functionality was needed should it well be more easy to extend those libraries than to create a new library, from scratch?

libev was not created by node.js folks. libev already existed as an alternative to libevent. To quote libev's README
" Libev is modelled (very losely) after libevent and the Event perl module, but is faster, scales better and is more correct, and also more featureful. And also smaller. Yay."
Boost.Asio is AFAIK a part of Boost and so has dependencies on other parts of Boost. It is also C++. The aim for node has always been to have a really small C kernel, and hoist as much stuff into JS as possible. This keeps it simple and makes development faster and easier to do cross platform.
libuv started as a small wrapper around libev by node developers. libev is Unix only, and does not support Windows async IO. libuv wrapped libev on Unix, while working with IOCP on Windows, but preserving the same API.
So those are the two reasons - no Boost.Asio to keep things small and no 'libev only' for Windows support.
Eventually libev was removed from the underlying code and libuv took over most of its responsibilities. Why this was done I'll let more knowledgeable people answer.
Nikhil

Ben Noordhuis

unread,
Apr 4, 2013, 7:21:28 PM4/4/13
to nod...@googlegroups.com
I guess that's my cue. :-)

Libev was removed for the reasons outlined here:
https://github.com/joyent/libuv/issues/485

I would have dropped it sooner but there were still a lot of node.js
add-ons that used libev in some way. You have to give people time to
upgrade.

Boost.Asio was never really an option. It's very C++-y while node.js
is more "C with classes" but what's more is that it didn't (and
doesn't) do everything we need. Someone on SO wrote a great post that
details the differences so I'll just link to that:
http://stackoverflow.com/questions/11423426/how-does-libuv-compare-to-boost-asio

Ryan Dahl

unread,
Apr 4, 2013, 9:42:51 PM4/4/13
to nodejs
Reply all
Reply to author
Forward
0 new messages