13

I am curious what gives nodeJS the super concurrency that it gets right now. I have not actually used with either of these that much, just played with both in my spare time.

Sounds like the 1000s of connections that node promises that you can set it up with, you can do that even with libevent, say in C++, no?

Mohit
  • 153
  • 2
  • 6

1 Answers1

25

Sure you could. In fact, node.js is implemented using libev which is an event library similar to libevent. I think the main advantage of node.js over rolling your own event-driven server in C++ is that it's really easy to use and really easy to get a server up and running quickly without having to write all of the event-based details yourself.

jterrace
  • 64,866
  • 22
  • 157
  • 202
  • 14
    The only thing I would add, is that in C++, you can do some multi-threading code that uses shared-memory data structures. In NodeJS, it would be close to impossible, since webworkers are currently based on separate processes. So if you have some CPU intensive calculations that use a huge (lets say 1GB) shared-memory structure, C++ might be a better fit. But the ease of development and maintainability in NodeJS trumps C++ in almost every other respect. – Amir Mar 17 '11 at 05:17