650) this.width=650; "src=" http://images2015.cnblogs.com/blog/139239/201706/139239-20170602095947336-1982532912.jpg "/>
May 30 12 o'clock, node. JS 8 is officially released with a range of new features and performance improvements, and these features and improvements will be supported in the long term (LTS).
The most important features and fixes in the node. JS 8 release are described below.
The new version of the code is carbon. node. JS 8 will officially become the current LTS version from October 2017 onwards and continues until December 31, 2019. This also means that the node. JS 6 version will enter maintenance mode in April 2018 and end Maintenance support in April 2019.
Download the node. JS 8 Version: https://nodejs.org/download/rc/v8.0.0-rc.2/
Async Hooks API Introduction
The Async Hooks (formerly known as Asyncwrap) API allows for structural tracking information about the life cycle of the handle object.
the message emitted by the API informs consumer of the life cycle of all handle objects in node. js. It tries to solve a problem similar to the continuation-local-storage npm package .
If you are using Continuation-local-storage, you can already use the name Cls-hook Async hooks instead of using it – it's not the best time to use async hooks, so be careful!
how the Async Hooks API Works in node. JS 8
The registration function of the Createhooks function is called by the different life cycle events of each asynchronous operation.
Const Asynchooks = require (' Async_hooks ')
Asynchooks.createhooks ({
Init
Pre
Post
Destroy
})
Learn More Async Hooks , or view the in-progress Work Documents . These functions will be triggered selectively based on the life cycle events of the handler object.
N-api Introduction
N-api is an API for building native plug-ins. It is independent of the underlying JavaScript runtime and is maintained as part of node. JS itself. This is done to ensure that the application binary interface (ABI) remains stable between different versions of node. js.
The purpose of N-API is to separate the add-ons from the changes in the underlying JavaScript engine so that the native plug-in can run different versions of node. js without recompiling.
Learn More N-api information.
buffer security improvements in node. JS 8
Prior to node. JS 8, Buffers allocated using the new buffer (number) constructor did not use zeros to initialize the memory space. As a result, new buffer instances may contain sensitive information that can lead to security issues.
While this is a decision to improve the performance of creating new buffer, it is not intended to be used by most people. Therefore, starting with node. JS 8, the buffers allocated with new buffer (number) or buffer (number) is automatically populated by zeros.
upgrade V8 to 5.8:turbofan&ingnition
With the node. JS 8 version, the underlying V8 JavaScript engine is also updated.
For node. JS users, the biggest change is the introduction of turbofan and ignition. Ignition is the V8 interpreter, turbofan is the optimizer compiler.
"The combined use of ignition and turbofan has been developed for nearly 3 years, representing the end result of the collective understanding of the V8 team, the V8 team has collected the measured performance of JavaScript and carefully analyzed Full-codegen's shortcomings and crankshaft results. This is also the basis for continuing to optimize the JavaScript language system over the next few years. "-Daniel Clifford and V8 team
The currently V8 compilation pipeline is as shown.
650) this.width=650; "src=" Http://images2015.cnblogs.com/blog/139239/201706/139239-20170601162813399-1254786345.png "/>
The biggest problem with this pipeline is that the new language features have to be implemented in different parts of the pipeline, which adds a lot of additional development effort.
Here is the simplified pipeline, without the Fullcode generator and crankshaft:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201706/ 139239-20170601162823664-1601493081.png "/>
The new pipeline greatly reduces the technical burden on the V8 team and achieves many improvements that were not previously possible.
Learn More Turbofan and ignition and the Turbofan inlining Heuristics .
upgrade NPM to 5.0.0
The new node. JS 8 version also comes with NPM 5-the latest version of the NPM CLI.
highlights of the new NPM release:
A new standardized locking file feature for compatibility across package managers (Package-lock.json), and a new format and semantics for Shrinkwrap
--save is no longer needed because all installations will be saved by default
NODE-GYP now supports Windows Node-gyp.cmd
The new release version will include SHA512 and SHA1 checksum
Other notable changes in node. JS Version 8Buffer
The buffer method now accepts Uint8array as input
Child Process
Console
Error event sending is now suppressed when using the console method
Domains
Native promise instances are now domain-aware
File System
HTTP
Stream
Stream now supports destroy () and _destroy () APIs
TLS
The rejectunauthorized option now defaults to True
URL
The implementation of the WHATWG URL is now fully supported by the node. JS API
node. js 8 What to do next
The node. JS 8 Release excites us because it contains a lot of interesting improvements, such as the Async Hooks API, which is difficult to master in the current document state. We will start using the new version as soon as possible and provide a more detailed description of the user's new features as soon as possible.
Among the many products that support node. js, it is worth mentioning that Wijmo , this is a set of development controls for enterprise application development that includes HTML5 and JavaScript. Whether your application is mobile, PC-side, or must support IE6,WIJMO Enterprise can meet demand.
Original link: https://blog.risingstack.com/important-features-fixes-node-js-version-8/
Reproduced please specify from: Grape City control
This article is from the "Grape City Control Technology Team Blog" blog, declined to reprint!
What are the important features and fixes for
node. JS 8?