Search code examples
c++node.jsembedv8embedded-v8

Does NodeJS have any performance demerits or significant overhead in comparison to pure V8?


The application I'm developing runs on a desktop environment. On the back-end, it runs C++. The front end is user-modifiable and written in JavaScript that uses some exposed classes/functions from the C++.

I'm currently trying to determine whether the application should simply run v8 alone in order to run the JavaScript code, or if it should "upgrade" to using NodeJS. The benefit to upgrading would be access to a plethora of Node modules, both built-in and third party for users to rely upon. However, I am concerned that the performance of the JavaScript may be hindered due to the extra baggage that Node would bring with it.

Perhaps it would be better to implement by own versions of the most common Node modules in the C++ back-end and expose them to the JS? Or are they going to have irrelevant/no performance differences whatsoever?


Solution

  • Building against NodeJS will not incur a significant performance penalty. It might, however, introduce a maintainability penalty and a security penalty. NodeJS may have many features that you are not using in your application. It might have features that you actually don't want your Javascript authors to have access to. Are you running in a high security environment? You might want to limit your Javascript authors' access to the filesystem and to the network. If you are running third party untrusted code within your application, and your application is running on a separate third party's system, you definitely have security implications to think about. In this case, building directly against V8 would be a better choice.