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.

  • 1
    Have you tried [Artillery][1] [1]: artillery.io
    – user63068
    Nov 28, 2019 at 7:15
  • 1
    Also check loadimpact and k6
    – user63068
    Nov 28, 2019 at 7:18
  • 1
    @krishna By all means post these as an answer and I'll award you the bounty
    – dwjohnston
    Dec 2, 2019 at 2:14
  • Please let me know which tool met your requirements.
    – user63068
    Dec 2, 2019 at 4:45
  • best suits your requirement
    – user63068
    Dec 2, 2019 at 4:52

1 Answer 1




Automate and extend: Artillery is built with automation in mind. The artillery CLI is easy to wrap in other scripts and integrate with CI/CD systems. JSON log output is supported to enable easy custom reporting or assertions. There's an official Docker image. And Artillery itself is easy to extend in Javascript with custom engines (for additional protocols), plugins (e.g. to generate data for tests or integrate with external systems), or custom reporters (to send metrics and test results to another location).

✓ Full power of Javascript and NPM: Add custom behavior to your scenarios or to Artillery itself with Javascript. Use any module from NPM to get things done quickly.

✓ Easy to learn, easy to use: Artillery's scenarios are written in YAML (and as much or little Javascript as you need), making your test scripts easy to read, write and maintain. Everybody on your team can read YAML (developers, QA engineers, SREs, BAs) and Javascript is the most widely known programming language on the planet, which makes cross-functional and cross-team collaboration easier. And of course since everything is code, it can all go into source control.

✓ Detailed performance metrics: See response times/latency percentiles, requests per second, concurrency, throughput, or track custom application-specific metrics with a tiny bit of Javascript code. All metrics are availble as text or structured JSON, and Artillery can ship those to an external monitoring system such as Datadog, Librato or Influx.

✓ Actively developed and supported: Artillery is under active development with a variety of community-developed plugins and engines available. Commercial support is available for enterprise teams.

✓ Open source: Artillery is open source under MPLv2, which is an OSI-approved, permissive, and non-viral license.

✓ Load + functional testing: Re-use the same scenarios to run either load or functional tests. Use assertions and expectations on the responses, and easily extract and store data from responses to re-use in subsequent requests.

✓ Batteries included: Test systems using a number of protocols (HTTP, Socket.io, WebSockets, AWS Kinesis), send metrics to external monitoring systems such as Datadog, Librato or Influx or anything else that speaks StatsD.

k6 Load Testing Tool

enter image description here


With k6, you get a developer-centric load testing tool with flexible and powerful scripting in ES6 JavaScript, modern command line interface, and good automation support. We couldn't find such a tool available on the market, so we built k6.

Open source and community

Automation native k6 is built to integrate into your development environment as well as your Continuous Integration (CI) or automation environment. That's why k6 is a command-line tool with features like custom metrics, checks (like asserts) and thresholds. You have several result output options, including LoadImpact Insights for automated results analysis.

Based on familiar and powerful ES6 JavaScript


Create ES6 JS modules that can be reused across tests and teams to build a foundational performance testing library for your organization.

Checks and Thresholds

Checks (like asserts) are used to validate functional aspects of your test. Thresholds is the essential feature that you use to specify the pass/fail criteria of your tests. You can create thresholds based on any of the standard metrics collected by k6, as well as any custom metrics that you define.

HTTP/1.1, HTTP/2 and WebSocket

Ready for the present and future k6 supports performance testing systems that talk HTTP/1.1 HTTP/2 and WebSocket.

Batteries included standard library

Besides the standard ES6 JS APIs, k6 comes bundled with APIs to handle Cookies, Crypto, Encodings, Environment variables, HTML forms, HTML parsing, Multipart requests, TLS client certificates, TLS ciphers & versions and more.

Local Execution

Run tests from your local machine to debug a test script or to get quick performance feedback before pushing code to version control and CI.


Run tests from on-premise machines or cloud servers under your own AWS, Azure or GCP account.

Managed, Cloud Execution

For convenience and to scale out, you can move your scripts without changes to run on Load Impact's global cloud infrastructure.

  • Hi Krishna. Please update your answer with some details explaining how your recommendations meet the question's requirements. Thanks! Dec 3, 2019 at 20:23
  • TBH Neither of these really are what I want. Both are them appear to be server load testing. I want to be measuring/testing the performance/cost of an individual function.
    – dwjohnston
    Apr 5, 2021 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.