Node 12 - What Are The New Improvements And Features?
Node has released it's version 12 in late April (codename
Erbium) which brings improved support for ECMAScript modules. It implements
phase 2 of the plan that was released late last year as it's Node v12 (this is
as even-numbered version) which comes under Long term support start from
October 2019 & will get support till 2022 it also packed with V8 engine
which is maintained by Google so will receive updates in future as well.
Node 12 New Features
Node 12 Features
Node.js 12 features include faster startup and better
default heap limits, updates to V8, llhttp, TLS, new features including
diagnostic report, bundled heap dump capability and updates to Worker Threads,
N-API and ES6 module support and more let's check what's new in Node js 12.
V8 Engine Updated to V8 7.4
As always a new version of the V8 JavaScript engine brings
performance tweaks and improvements to Node. It was initially running on V8
.7.2 (updated in Dec 18) and eventually upgrade to 7.6 in April which included
notable improvements with V8 7.4 are performance updates for faster JavaScript
execution, better memory management, and broadened ECMAScript syntax support.
Major Features of V8 version 7.4
JIT-less V8
Version 7.4 now allows JavaScript execution without
allocating executable memory at runtime it relies heavily on the ability to
allocate and modify executable memory at runtime in its the default
configuration & creating executable memory at runtime is part of what makes
V8 fast.
WebAssembly Threads/Atomics shipped
WebAssembly Threads/Atomics are now enabled on non-Android
operating systems which unlocks the usage of multiple cores on a user’s machine
via WebAssembly, enabling new, computation-heavy use cases on the web.
Faster calls with arguments mismatch
JavaScript engines must provide a way to get to the actual
parameters. In V8 this is done via arguments adaption, which provides the
actual parameters in case of under- or over-application. In the latest version,
V8 now completely skips arguments adaption, reducing call overhead by up to
60%.
Improved native accessor performance
Parser performance
Bytecode flushing in memory
Bytecode dead basic block elimination
JavaScript language features include Private class fields
Hashbang grammar
V8 API
ES6 Module Support
The import/export syntax has become the favorite module
syntax for developers since its standardization in ES6, and the Node team has
been working on it to enable natively. Mostly all major browsers support
ECMAScript modules via
Types of import from ES modules files for phase 3 that will
work with all built-in Node packages:
// default exports
import module from 'module'
// named exports
import { namedExport } from 'module'
// namespace exports
import * as module from 'module'
Phase 3 for ECAM Script Modules in Node 12 which correspond
to a path to the stability of the modules and the plan is to remove the
--experimental-modules flag into LTS version.
Private Class Fields
Node V 12 has shipped with private class fields These variables
are only accessible within the class itself and can't be accessed externally
& if you try to access it outside of the class, you will receive a syntax
error and private class field is initialized with the # symbol.
Improved Startup Performance
Node.js 12 feature brings an updated experimental version of
support for ES6 modules. It will generate the code cache for built-in libraries
before build time and embed it as a binary. The main thread is able to use this
code cache and gives a 30% speedup in startup time for the main thread.
New compiler and platform minimums
Node 12 takes the full advantage of newer compiler
optimizations and security enhancements. The codebase requires a minimum of GCC
6 and glibc 2.17 on platforms other than macOS and Windows. The increment in
minimum compiler and libc requirements also increments minimums in supported
platforms. Node binary uses a new toolchain minimum which provides compile-time
performance and security enhancements. Windows minimums remain the same as Node.js
version 11, requiring at least Windows 7, 2008 R2 or 2012 R2 and a minimum
compiler of Visual Studio 2017 and Mac users needing to compile Node will
require a minimum of Xcode 8.
TLS 1.3 and Security
Node added TLS 1.3 support which increases security and
reduced the latency. TLS has been a major update and it actively being
integrated across the web. TLS 1.0 and 1.1 have been disabled by default, and
the crypto library has removed deprecated functions. With TLS 1.3, Node.js apps
have increased end-user privacy & also improved the performance of requests
by reducing the time required for the HTTPS handshake.
Heap Dump
Node.js 12 brings integrated heap dump capability out of the
box. Previously the default V8 heap sizes were 700MB for 32-bit systems &
1400MB for 64-bit systems, Now it will automatically determine the heap size
that it does not use more than the allowed resources.
Native Modules N-API Improvements
N-API provide ABI compatibility across various Node.js
versions and also across different Node VMs - allowing N-API enabled native
modules to just work across different versions. Node 12 added a feature to
improved support for N-API in combination with worker threads.
Diagnostic Reports
Node.js 12 includes an experimental feature named Diagnostic
report that allows developers to create a report on demand that will be
triggered by specific events.
Conclusion
Node team added some great features in their v 12 which will
definitely help the Node.js Development process and some features like planning
to include Python 3 support, improving startup performance, Core Promise API
support, further work on standards and governance, and a new Streams API will
be landing in the new node
release.[Source]-https://www.angularminds.com/blog/article/node-12-what-are-the-new-improvements-and-features.html
62 Hours AngularJs Training includes MongoDB, JavaScript, A62 ngularJS Training, MongoDB,
Node JS and live Project Development. Demo Lect available.
Comments
Post a Comment