Giter VIP home page Giter VIP logo

underscore-benchmark's Introduction

Offen logo

underscore-benchmark

Benchmarking stats calculation from offen/offen against different underscore versions.

Default setup

To run the benchmark from this repository, you first need to install the project's dependencies. Next, you can run the setup which does the following:

  • pull the underscore versions to compare and put them in the vendor directory
  • create fixture data for the benchmark to run against
npm install
npm run setup

Once this has finished, you are ready to run the benchmark in Node.js:

npm test

You can also run the benchmark in a browser:

npm start

budo will start a local server at port 9966: loading this URL in a browser will run the benchmark. Results will be printed to your browser's console.


If used with defaults, the benchmark will use commit c9b4b63fd08847281260205b995ae644f6f2f4d2 as the baseline and eaba5b58fa8fd788a5be1cf3b66e81f8293f70f9 as the comparison for the benchmark.

Adjusting the benchmark

Running against a single version only

If you do not want to run the benchmark against both the baseline and the comparison version at the same time, you can choose to run a single test only.

Using the CLI, this is done by passing the desired test as the first command line arg:

npm t -- baseline

If you are using the browser, append the name of the desired case as the URL hash and reload the page, e.g. http://localhost:9966/#baseline

Running against different versions of underscore

If you want to run this benchmark against different versions of underscore, you can use the ./pull.sh script to pull any versions you want to compare from the jashkenas/underscore repository.

The script expects two arguments, the baseline ref and the comparison ref:

node ./scripts/pull-versions.js master some-feature-branch

Such an argument can be any either a branchname or a commit hash for the repository.

Running against more/less user data

By default, the benchmark runs against randomly created user data for 5000 users. This is an average real-world workload for the code under test, so it's probably a sane default. If you want to benchmark how two versions of underscore compare with more or less data being processed, you can re-run the fixture creation, passing the non-default number of users as the first argument:

node ./scripts/generate-fixtures.js 2500 ./fixtures/events.json

Reverting your adjustments

If you want to revert your benchmark setup to the default state after making adjustments, you can use the setup command:

npm run setup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.