Node.js Performance API

JS
S
JavaScript

Concise guide for leveraging Node.js Performance API to measure and optimize application performance, including timing, memory usage, and resource consumption metrics.

1import { performance } from 'perf_hooks';
2
3performance.mark('PATCHES_START');
4performance.mark('PATCHES_END');
5performance.measure('PATCHES_START to PATCHES_END', 'PATCHES_START', 'PATCHES_END');
6const measure = performance.getEntriesByName('PATCHES_START to PATCHES_END')[0];

Created on 6/7/2019