Check if your module/function is optimized for the V8 engine. Download it and run it against (and from within) any module/function very quickly.
If it isn't check the WHY section below on reading material to help find reasons why and optimize your code.
npm install check-v8-optimised
var optimiser = require('check-v8-optimised');
var someModule = require('./someModule');
// specify arguments for your function
var args = [1, 2];
var optimiserResult = optimiser(someModule, args);
console.log(optimiserResult); // prints "Function is optimized"
The module returns a string which can be outputted to console, parsed inside a test or used anyway you like.
node yourFile.js
npm run test
npm run lint
Using available low level diagnostic commands in the V8 engine, can ask if a given function is optimized. See below for possible reasons why.
Inspired by an article from Bluebird on V8 optimising.