Exploring Node.js 18 feature

Abhinav Kumar
3 min readMar 23, 2023

Exploring some of the new exciting features in NodeJS 18, My top 3 features, that I am definitely going to use.

Photo by Max Chen on Unsplash

Node.js 18 has been released, bringing lots of exciting new features for developers. With every release, Node.js continues to evolve, enabling developers to create faster and more efficient applications.
In this article, we’ll take a closer look at some of the features in Node.js 18, along with examples of how to use them.

Speed and Memory

Node.js 18 comes with the latest version of the V8 engine, version 10.1. This version includes several performance optimizations that improve the speed and memory efficiency of JavaScript code. One of the new features is inline caching, which reduces the time taken to look up properties and functions in JavaScript objects.

We will take the sample code, and run it on nodeJS 18 and its previous version and observe the difference.

const user = { name: "abhinav", age: 28, city: "berlin" };
console.time('lookup');
for (let i = 0; i < 1000000; i++) {
const name = user.name;
}
console.timeEnd('lookup');

Here is the result of version 16.19.1

Running on node version 18.15.0

From 6.131 ms to 3.664 ms, is quite a significant difference.

I will strongly recommend the latest stable version in the production application to get better performance.

Core Testing Modules

A new way to ‘import’ modules that leverages a ‘node:’ prefix, which makes it immediately evident that the modules are from Node.js core. If the ‘node:’ prefix is not available, NodeJS will look for a module in the node_modules. It also reports time duration, number of tests passed, number of tests skipped, and number of tests canceled.

--

--

Abhinav Kumar

Software Engineer @Zalando, Living in Germany, Tech enthusiast, Story Teller, Write about my learning and experiences in tech and in life.