npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

karma-benchpress

v0.1.0

Published

Karma plugin to run angular-benchpress benchmarks.

Downloads

4

Readme

Status: In-Development

See https://github.com/angular/benchpress for information about benchpress.

This project allows automated execution of already-built benchpress benchmarks through Karma.

See example/karma-experiment.conf.js for reference configuration and see [example/jasmine-spec-experiment.spec.js] for reference spec.

bpSuite

This plugin comes with an adapter that provides a global function called bpSuite that allows imperative execution of a benchmark with custom configuration. bpSuite returns a promise that will resolve with the result object

it('should be within acceptable limits', function(done) {
  bpSuite({url: 'base/largetable/index-auto.html', variable: 'ngBind', numSamples: 15, iterations: 20}).
    then(function(result) {
      expect(result.$apply.testTime.avg.mean).toBeLessThan(15);
      expect(result.create.testTime.avg.mean).toBeLessThan(1500);
      done();
    }, function(reason) {
      console.error('failed because', reason.message);
    }).then(null, function(e) { console.error('something went wrong', e); done()});
});

The bpSuite options object can have the following properties:

| Property | Required | Description | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | url | yes | Url of the benchmark to be executed (ie. base/largetable/index-auto.html) | | variable | no | Benchpress variable with which to run the benchmarks | | numSamples | no | How many samples to collect. Will use benchpress default (currently 20) if not specified | | iterations | no | How many iterations to run (should be greater than samples). Will use benchpress default (currently 25) if not specified |

The adapter will serialize all non-reserved properties into query parameters in the benchmark's url, so any supported benchpress paramaters may be used here.

Result Object

The result object has the following structure:

{
  stepName1 : ...,
  stepName2: {
    testTime: {
      avg: {
        mean: 5.0, //milliseconds of how long the step took to execute
        stdDev: 0.1, //Standard deviation of sample
        coefficientOfVariation: 0.02 //stdDev as percentage of mean
      },
      min: 4,
      max: 6,
      history: [
        4.0,
        5.0,
        6.0
      ]
    },
    //All other measured characteristics have the same structure, though they may represent values other than time
    gcTime: ..., //time spent collecting garbage after this step
    garbageCount: ..., //how much garbage was generated during this step in KB
    retainedCount: ..., //how much memory is retained by the step
  }
}

Gotchas & FAQs

  • jasmine.DEFAULT_TIMEOUT_INTERVAL should be set to a number high enough to run all iterations of the benchmark. This would be best inside of a beforeEach/afterEach which will set the interval back to its original value
  • A custom launcher based on Chrome Canary should be used to provide the best memory profiling characteristics. An example launcher configuration can be found in the example karma config.
  • This plugin and the bpSuite function have no dependency on Jasmine, though Jasmine is the only framework with which it has been tested.