How to test a code performance in Node.js?
This blog post describes how to test a code performance in Node.js platform.

- install our Node.js module Performance Meter
$ npm install performancemeter - and create custom tests
Running tests
- save each test into separate file
- run
$ node testname.js
Caching objects
const Meter = require('performancemeter');
Meter.measure('Uncached', function() {
fn({ success: true });
}, function() {
function fn(obj){obj.success;}
});
Meter.measure('Cached', function() {
fn(success);
}, function() {
var success = { success: true };
function fn(obj){obj.success;}
});
Caching object with assignment
const Meter = require('performancemeter');
Meter.measure('Uncached', function() {
fn({ success: INDEX % 2 === 0 });
}, function() {
function fn(obj){obj.success;}
});
Meter.measure('Cached with assignment', function() {
success.success = INDEX % 2 === 0;
fn(success);
}, function() {
var success = { success: true };
function fn(obj){obj.success;}
});
Delete vs Undefined
const Meter = require('performancemeter');
Meter.measure('delete', function() {
var obj = { success: true };
delete obj.success;
JSON.stringify(obj);
});
Meter.measure('undefined', function() {
var obj = { success: true };
obj.success = undefined;
JSON.stringify(obj);
});
Meter.mode('low');
Caching DateTime
const Meter = require('performancemeter');
Meter.measure('Uncached', function() {
fn(new Date());
}, function() {
function fn(dt) {dt;}
});
Meter.measure('Cached', function() {
fn(current);
}, function() {
var current = new Date();
function fn(dt) {dt;}
});
Meter.measure('Partially cached', function() {
if (INDEX % 5 === 0)
current = new Date();
fn(current);
}, function() {
var current = new Date();
function fn(dt) {dt;}
});
Keep reading
Using AI for Traffic Analysis and Smart Parking Monitoring
Discover how AI, NVIDIA Jetson AGX, and Total.js IoT transform camera data into traffic insights and automated parking occupancy monitoring.
Total.js Platform and NVIDIA DeepStream: Automated AI Video Anonymization
Discover how we combined Total.js Platform, Total.js Flow, and NVIDIA DeepStream to build a scalable, GPU-accelerated video anonymization system for a major enterprise customer. Explore how we process large volumes of video recordings, automate workflows across multiple locations, and manage AI-powered anonymization through a centralized interface.
October report 2026
A quick overview of all changes and news from the entire Total.js Platform. Read more about our work.
Node.js Security Vulnerabilities
Recent Node.js security updates have addressed serious vulnerabilities, including an issue in Brotli decompression. The news is particularly interesting because AI-assisted security research helped uncover a flaw in technology used by applications around the world.
September report 2026
A quick overview of all changes and news from the entire Total.js Platform. Read more about our work.
August report 2026
A quick overview of all changes and news from the entire Total.js Platform. Read more about our work.
How to write better Total.js Applications using AI?
Learn how to make AI coding agents write better, more native Total.js applications!
July report 2026
A quick overview of all changes and news from the entire Total.js Platform. Read more about our work.
Total.js AIModel: a practical foundation for AI-powered workflows
How Total.js helps developers integrate AI models into real applications with routing, actions, streaming, tools, validation, and business logic in one coherent stack.
June report 2026
A quick overview of all changes and news from the entire Total.js Platform. Read more about our work.