What's new in Node 10 | Features and improvements

    May 23, 20188 min read13445 viewsUpdated:Nov 27, 2024
    What's new in Node 10 | Features and improvements

    Time flies Node has released it's version 10 and it's going under the codename “Dubnium”. It been over seven years since Node was released and it's their 7th major release.  Now let's jump into what's new in node 10 and what they have deprecated in their new release!


    Node has released their stable version to 10.1.0 and the new release line with active LTS (Long Term Support, currently v8.11.2) support will start from October of 2018 and it will be for long 3 years. Releases in the Long Term Support line focus on Performance, security, stability, extended support and providing a reliable platform for applications of any scale.

    Node 10 features and improvements

    Improved HTTP & HTTP/2  in node 10
    HTTP/2 is a higher performer than it's the previous version of HTTP. The implementation of HTTP/2 has landed in Node.js  v8.4.0(LTS) as an experimental feature. With Node v10 the HTTP 2 module has become a stable addition to the Node core for web applications and the web platform.


    Loading a web page is very intensive, as HTTP only allows one outstanding request per TCP connection but HTTP/2 supports queries multiplexing which allows multiple requests at the same time and therefore speeding up the process of delivering web pages and content. Google offering a ranking boost for fast-loading websites. With HTTP/2, your website should load faster than the previously HTTP protocol, meaning that your website should enjoy boosted rankings on search engine results pages makes it's SEO friendly.

    Stable HTTP/2 support

    What's introduced in HTTP/2 

    • Multiplexing
    • Single Connection
    • Server Push
    • Prioritization
    • Header Compression

    Overall, HTTP/2 is starting to wind down as the implementation becomes more and more stable and performant. The goal is to move it out of experimental status as soon as possible in 2018.

    N-API is no longer experimental
    N-API is an API that allows developers to build native Add-ons. When JavaScript performance isn't enough for providing the performance boost to the codebase we used Node.JS Add-ons by providing an interface between JavaScript running in Node.js and C/C++ libraries. We can use that interface to build dynamically-linked shared objects in C++ that we can load into a Node.js application through a require() function.Add-ons is same as Node.js modules but offers a performance boost for computationally demanding applications when needed. 

    The goal is to protect Addons to be stable across all versions of Node.js modules compiled for one version can run on later versions without re-compilation. So they have added the Application Binary Interface (ABI) stable module APIs (N-API) as an officially supported API layer.

    ABI is very much similar to API. When you write source code, you access the library through an API. Once the code is compiled, your application accesses the binary data in the library through the ABI. The ABI defines the structures and methods that your compiled application will use to access the external library (just like the API did), only on a lower level.
    If program access particular library and that library is later updated, you don't want to have to re-compile that application. If the updated library uses the same ABI, then your program will not need to change.N-API adds ABI stability to Node.js helps module maintainers and production deployments.

    Performance improvements with V8 Engine v6.6
    Node.js V8 has been updated to it's version 6.6 in Node.js 10 with guaranteed forward ABI compatibility with V8 6.7. which comes with Chrome 66 and provides the reduction of around 20–40% in both parse and compilation time of JavaScript.Promise and async/await execution has improved significantly, resulting in Hapi v17 realizing a 30% increase in throughput. 

    Performance improvements benchmarks

    We can expect Node.js v10 a huge benefit in this area, also brings Async generators and array performance improvements. Array#reduce has increased by more than 10 for holey double arrays. The performance of Async generators along with Async iterations was considerably improved.

    array reduce performanceUpgrade to OpenSSL version 1.1.1
    The finalization of the TLS 1.3 specification, a huge step forward for the security of the web applications, the OpenSSL team released its 1.1.1 (Beta 4 ) in May, the primary feature of which is TLS 1.3 support. Node.js10 is the first release to include OpenSSL 1.x sets it up for an easy API and ABI stable upgrade after OpenSSL 1.1.1 released. Recent work by OpenSSL and the Core Infrastructure made it possible for Node.js 10 to really take advantage of OpenSSL including the ChaCha20 cipher and Polu1305 authenticator.

    NPM v6 ships immediately
    Node 10 has updated its NPM from v5.7 to v6.0. This major version increase in NPM provides an improvement in all areas including the focus on performance, security, and stability offering major performance boost compared to prior versions of NPM. Continuous progress on security triage for third-party NPM modules (not directly introduced to the Node 10 or Node 11 release lines). More information on NPM v6.

    ESM Modules in Node v10
    The problem is two module systems are not compatible so the Modules Team had to find a proper solution so JavaScript modules could be built on a platform to be used both in Node and in browsers. You could work this around using the module pattern, but it still wasn’t really convenient.

    By Introducing bundlers and ECMAScript Modules this problem is somewhat mitigated, but not yet fully solved. Node.js has had its own module system, but ECMAScript 6 brought a standardized module system to JavaScript. Node's module system is called CommonJS.Best suited for the Node environment only and if you try to run a CommonJS file in the browser, you'll get many red flags in dev tools.

    Error-Handling Improvements
    The Only way to match error in node was in try-catch clauses to check for the error message but users can only match the error message when handling errors in this approach. Previously any changes to the text for an error needed to be delayed until a semVer major release, meaning error changes couldn’t be made until the next major version of Node.js shipped. Node.js major versions ship every six months.

    In Node 10 they have added error codes as all errors thrown by the Node.js APIs will through error code that should be readable for humans to begin with we don't need to match error messages like we used to do in node previous versions.

    Experimental Fs-promises
    Nodejs v10 will be shipping with an experimental version of the fs package with promises.Node.js v8 introduced util.promisify to easily wrap functions that provide a callback API. Now developers can utilize fs with promises-type APIs directly and in most efficient manner without needing the extra step.

    Promise performance

    New JavaScript Language Features

    New JavaScript language features introduced in node.js v10

    1. Function.prototype.toString()

    This method returns exact slices of source text which include whitespace and comments.

    2. The function trimLeft() and trimRight() becomes aliases for the newly implemented String.prototype.trimStart() and String.prototype.trimEnd() to ensure backward compatibility

    3. The catch clause of try statements no longer requires a parameter.

    APIs deprecated in Node 10
    1. Using require() to access several of Node.js own internal dependencies will emit a runtime deprecation.
    2. Use of the tls.convertNPNProtocols() method will emit a runtime deprecation warning.
    3. Previously deprecated legacy Async_hooks APIs have reached end-of-life and have been removed.4. Previously deprecated internal getters/setters on net.Server has reached end-of-life and has been removed.

    Conclusion
    Best thing is Node will continue on improving and even add more new features for Node.js Developers to deliver reliable and scalable code. we are looking forward to the future integration with TLS 1.3 and @npm6.
    As per the release schedule, Node.js 10 will become Node.js 10 "Dubnium" LTS in October 2018. This means that both the features shipping with Node.js 10 on release and any features that are developed and included prior to the LTS release date will be supported until April 2021.

    Check our blog on Why To Choose Node.js For Server Side Programming

    24

    Related articles

    This website uses cookies to analyze website traffic and optimize your website experience. By continuing, you agree to our use of cookies as described in our Privacy Policy.