I'm looking for a tool to provide performance analysis of various JavaScript functions.

ie If have some code that looks like this:

function solveTravelingSalesman(nodes) {

then I want to be able to do something I want to be able to call this function with say some consistent data of say 1000, 1,000,000 and 10,000,000 nodes, and measure:

  • The time taken, or number of computations taken*.
  • The peak memory used.

Ideally this tool would provide deterministic results (ie. multiple runs of the same function and data always return the same results. (hence 'number of computations' is a better metric, as CPU performance may vary)).

However, if that's not possible, that's OK.

I could do something using Date.now() and process.memoryUsage(), but this is messy, and for a synchronous function I can't measure the memory usage until after the function has completed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.