Showing posts with label features. Show all posts
Showing posts with label features. Show all posts

Wednesday, November 27, 2019

What’s new in Node.js 12?

Node.js has been a game-changing technology from its initial release in 2009. Basically, it allows developers to use JavaScript to run scripts on the server side producing dynamic web content before the page is sent to the user’s web browser. Subsequently, Node.js represents to a “JavaScript everywhere” paradigm, unifying web web application development around a single programming language, instead of requiring various languages for server-side and client side scripts. 
On April 23rd, 2019, Node.js 12 officially launched. What’s more, let’s get straight to the point, this isn’t only a regular old version update, this is a big overhaul with some significant upgrades, let us see the list of highlights.

New features of Node.js 12-

1. V8 Engine Updated to V8 7.4-

As usual a new version of the V8 JavaScript engine brings performance changes and upgrades to Node. It was initially running on V8 .7.2 (updated on Dec 18) and eventually upgrade to 7.6 in April which included outstanding upgrades 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 allows JavaScript execution without allocating executable memory at runtime it depends heavily on the ability to allocate and modify executable memory at runtime in its default configuration and creating executable memory at runtime is a part of what makes V8 fast.
WebAssembly Threads/ Atomics shipped-
WebAssembly Threads/Atomics are now enabled on non-Android operating systems which allows the use of different 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 give an approach to get to the actual parameters. In V8 this is done by means of arguments adaption, which provides the actual parameters in case of under or over-application. In the most recent version, V8 now totally skips arguments adaption, reducing call overhead by up to 60%.
Check out More of the v8.7.4 New Features Below:
  • Improved native accessor performance
  • Parser performance
  • Bytecode flushing in memory
  • Bytecode dead basic block elimination
  • JavaScript language features include Private class fields
  • Hashbang grammar
  • V8API

2. ES6 Module Support-

The import/export syntax has become the most favorite module syntax for developers since its standardization in ES6, and the Node team has been working on it to enable natively. Generally all major browsers support ECMAScript modules by means of  -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 way to the stability of the modules and the plan is to remove the – experimental modules flag into LTS version.

3. Startup time improvements-

Node.js 11 reduces startup time of worker threads almost 60% by using built-in code cache support. Node 12 has built upon this idea to generate the code cache for built-in libraries in advance at build time, enabling the primary thread to utilize the code cache to start up the initial load of any built-in library written in JavaScript. The end result is another 30% speedup in startup time for the main thread, and your applications will load for users faster than ever before.

4. Native modules get easier in Node.js-

Stepping back from the low-level improvements, there’s some cool stuff additionally coming for developers and module makers inside the Node ecosystem. Making and building native modules for Node keeps on improving, with changes that include better support for native modules in combination with worker threads, as well as the version 4 release of the N-API, which makes it simpler to configure your very own threads for native  asynchronous functions. Summarized, this implies creators and maintainers of Node-specific modules have almost as simple a time keeping up these modules as pure JavaScript module creators. The increased complexity that came about because of maintainers expecting to rebuild the distributed binaries for each Node.js version they needed their modules to support is now largely abstracted away courtesy of the N-API.

5. Integrated heap dumps-

Another feature in this release around heaps, sure to accelerate the debugging procedure, is integrated heap dumps, which ships with Node.js 12, already built-in. Presently there’s no need to install new modules to examine memory issues- simply tell Node what kind of JSON-formatted diagnostic summary you need by means of the command line or an API call and parse through all of the information you can deal with.

6. Diagnostic reports on demand-

Changing the discussion to debugging, there’s a new experimental feature  in Node.js 12 enabling users to generate a report on demand or when certain trigger events occur. This kind of real-time reporting can help analyze issues in production including crashes, slow performance, memory leaks, high CPU utilization, unexpected errors, and so forth- the kind of stuff that typically takes hours if not days to debug, analyze and fix.

7. Properly configured default heap limits-

Presently, we should discuss some lower level upgrades. So far, the JavaScript heap size defaulted to the maximum heap sizes set by V8 for use with browsers, except if manually configured generally. With the release of Node.js 12, the JS heap size will be configured based on available memory, which ensures Node doesn’t attempt to utilize more memory than is available and terminate processes when its memory is exhausted. Say goodbye to out of memory errors- probably some of the time- when processing a lot of data. The old – max-old-space-size banner will still be available to set a different limit if needed, yet ideally, this feature will reduce the requirement for setting the flag.

Conclusion-

These are some amazing features in Node v 12 which will help the Node.js Development process and a few features like planning to include Python 3 support, improving startup performance, Core Promise API support, further work on standards, and another Streams API will arrive in the new node release.
You have seen these new features of Node.js V12. There might be few also. Node 12 can be the best choice due to these new features. If you are still confused about server-side development with Node.js, Connect with solace experts and develop the best software that will boost your business to the next level.

Friday, August 2, 2019

Node 8: Six New Features You must Know


A new version of Node.js is released which is Node 8. It came up with the new features that are true improvements to the LTS release line. These new features include as Ignition and TurboFan for V8 JavaScript Engine.
Node 8 will use V8 5.8 with ABI compatible with V8 6.0. This will provide better performance, a stronger support contract with V8 and a smaller delta between Node 8 and 9 as indicated by Node.js Collection. 

Features-

1. Async Hooks API- 

Async Hooks is a new experimental feature shipped with Node.js that goes deep into what a Node.js process is doing. It allows you to pull out a large amount of analytical information about that process. The Async Hooks (Formerly known as AsyncWrap) API got a notable upgrade to the latest version. This API enables you to get structural tracing information of the life of handle objects. The API emanates events that illuminate the customer about the life of all handle objects in Node.js. It attempts to settle comparable difficulties as the continuation-local-storage npm package, just in the core. Previously, a package called ‘co’ was used to utilize generators to write asynchronous code to create a more readable control flow. Now, this control flow can be implemented without the need of a third-party library. 

2. Buffer security improvements in Node 8-

There are 2 buffers, the first is zero filling Buffer and the second is a new Buffer. These both buffers are added by default. However, previously, the memory space was not initialized with zero. And hence one has to face  security issues because the Buffer instance had sensitive information. The upgrading with new version allows people to secure their privacy. However, it is advisable for the Node.js 8 users to first be aware of the risks involved in function and only then use to avoid the leakage of secure information. Though there is also a problem that you have to take performance hits. But it is good to process further with buffer.allocUnsafe (). 

3. TurboFan and Ignition-

With the new version of Node.js 8, you will find something entirely new V8 6.0. Here the, JavaScript runtime from Chromium that, by default powers the execution of JavaScript within Node.js. TurboFan and Ignition are the major updates to the internals of V8. It brings impressive performance gains with a variety of JavaScripts operations.
“The combined ignition and Turbofan pipeline have been in development for almost 3½ years. This shows the culmination of the collective insights that the V8 team has gleaned from measuring real-world JavaScript performance and carefully considering the shortcomings of Full-code gen and Crankshaft. It is a foundation with which we will be able to continue to optimize the entirety of the JavaScript language for years to come.”  

4. N-API-

This API will be the Application Binary Interface(ABI) stable with the versions of Node.js. This is proposed to protect Addons from changes in the hidden JavaScript engine. And it allows modules compiled for one version to run on later versions of NOde.js without any recompilation. The API is currently experimental. It is not depend on the underlying JavaScript runtime and is maintained as part of Node.js itself.
  • JS Binding for the Inspector– The new Inspector module allows developers to leverage the debug protocol. This tool is used by the Chrome inspector to inspect currently running JavaScript code. 
  • util.promisify()– This allows developers to wrap callback APIs to return Promises. The function works with little overhead and follows a standard API. 

5. HTTP/2-

It is a big update to Node.js which is carried out by Node.js 8 LTS. It came to function recently after exhaustive and long-term work driven by James Snell to discuss and make the difficult decisions about specific implementation details of HTTP/2 across the current HTTP implementation in Node.js core. The working path of HTTP/2 is different than the way Node.js developers have come to expect HTTP in Node to work. Hence there are some new and interesting workflows to learn.  

6. npm@5-

Formerly, Node.js 6 LTS came up with npm@3. This has brought some nice improvements to the previous versions. With the new Node.js 8 LTS, npm@5 brought some attractive features and performance. Some new features include lockfiles, local caching with offline fallbacks, SHA512 checksums and also a bunch of smaller features. In the context of performance, one can expect up to 5x performance increase in the best cases. In average you can expect 20-100% faster npm installs. 

Final Words-

Node.js version 8 also came up with a lot of interesting improvements such as Async Hooks API which is little bit difficult to adapt with current state of its documentation. All the new features with Node.js 8 not only improves the performance but also efficiency. 
Want to us use Node in you application? Be updated with the new features and appliactions of Node 8. Contact us for free consultation or any query. We are here to help you for upgrading with Node 8.