Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including js-profiler with all npm packages installed. Try it out:

var jsProfiler = require("js-profiler")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

js-profiler v1.24.0

Javascript profiling tool and collection of performance profiles for various JavaScript built-ins.


JavaScript profiling tool and library of profiling modules and benchmarks.

JS-Profiler allows you to compare different techniques and functions regarding execution speed and memory consumption. It reports results either in text or JSON format.


Build Status


npm i [-g] js-profiler



If installed with the -g flag you can simply run js-profiler from your command line:


For further information please refer to the CLI documentation and the man page.


// 1. Import the library
const jsProfiler = require('js-profiler');

// 2. Run the profiler
  .then((report) => {
    console.log(JSON.stringify(report, null, 2));

For configuration options please refer to the Library documentation.

Currently implemented performance profiles:


Variable guards: checking whether a variable is defined or of a certain type.

Profiled functions:

  • typeof !== undefined
  • typeof === type
  • Array.isArray
  • !!var
  • !var
  • isNaN(var)
  • prop in obj
  • obj.hasOwnProperty(prop)

Loop variations: Converting an array of integers into an array of booleans satisfying a conjunction of two simple relational operations.

Profiled functions:

  • [].forEach() => []
  • for(i++, i < d.length) => []
  • for(i++, i < len) => []
  • while(i--) => []
  • [].map() => []
  • while(i < d.length) => []
  • while(i < len) => []

Object literal vs. Map: retrieving values.

Profiled functions:

  • Map.get()
  • {}.prop

Object literal vs. Map: creating a map.

Profiled functions:

  • Map.set()
  • {}.prop =

Recurstion variations: Calculating sum of array of integers. Profile contains a simple for-loop for reference.

Profiled functions:

  • for loop sum for reference
  • recursive sum
  • tail recursive sum




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free