Is October 2018, when the long run for a new Node.js LTS version is getting to an end. In this article, I would like to share with you a set of “pragmatic” performance tests, comparing older LTS branches in terms of “speed of execution”; as well as the coolest features available.
Keep reading and enjoy, what is in my opinion: the fastest and the greatest Node.js version till now.
Node.js 10 coolest features (top 3)
You can checkout a basic example using the N-API in this github repository: https://github.com/mafintosh/a-napi-example/blob/master/a_napi_example.c
Also read more about this topic here: “Node.js Removes Version Dependencies for Native Modules”
Node.js v10 LTS brings in a native, stable HTTP2 support!
Meaning developers can take control over the biggest HTTP protocol update.
- HTTP2 Push
- Streams and Multiplexing: + efficient connections management.
- Binary protocol ;)
- Headers compression
- And many more… https://nodejs.org/api/http2.html
Workers/Threads (yet experimental)
If there was something impossible to do in Node.js before: those were intensive CPU tasks!
In Node.js 10, although yet in experimental status, we have the opportunity to use real worker/threads that will allow us to perform CPU intensive operations: the puzzle is now completed!
NOTE: We exclude I/O operations in here, as they were always highly optimised and natively multi-threaded by the Node.js engine.
The worker module is accesible under the flag: — experimental-worker. Let’s evaluate a complete example using the microjob👏 npm package:
Node.js v10.12.0 Documentation
The worker module provides a way to create multiple environments running on independent threads, and to create message…
Node.js 10 performance does impact!
DISCLAIMER: Benchmarking it’s a science, the results presented here are just practical impressions using out of the box technologies without any tweak or optimisation.
The test machine
MacBook Pro 2016 (2,7 Ghz Intel Core i7, 16GB RAM — LPDDR3)
Google Octane 2 Benchmark Tool
Couple of years ago the Octane 2 tests suite was a reference as a performance measurement tool, used by major browser’s vendors like Mozilla, Opera, Microsoft or Google.
Back in those days, if you wanted to show up with your Web browser release you had to present the Octane 2 test score…
The classic HTTP “Hello World” service
“When using Node.js, REST based micro-services are first class citizens.”
Here I want to show how HTTP services respond to heavy load using different Node.js frameworks implementation. The wrk tool is used for the benchmarks, 8 threads and 100 concurrent connections producing high load for 5 seconds against a single threaded HTTP service…
REST API + ASYNC + JSON
Here a basic express based REST API simulate asynchronous load with JSON payloads:
The “ABC” arrays operations
Arrays management operations in Node.js enterprise applications are kind of mandatory, next, the most used operations are evaluated. In the following benchmark we measure the speed of execution:
Node.js 10.x branch is almost marked as LTS and the enterprise is waiting for it: Welcome HTTP2, Workers/Threads, N-API, performance improvements and more! 👏👏👏👏