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

@futoin/optihelp

v1.3.0

Published

FutoIn package optimization helper

Downloads

26

Readme

NPM Version NPM Downloads Build Status stable

NPM

About

FutoIn OptiHelp is Node.js module optimization helper.

Unlike simple benchmark tools, FutoIn OptiHelp stores base and best results. It helps you to understand how new optimization and other changes affect performance of your project over time.

Documentation --> FutoIn Guide

Author: Andrey Galkin

Installation for Node.js

Command line:

$ npm install @futoin/optihelp --save

or:

$ yarn add @futoin/optihelp --save

Concept & notes

  1. Tests are unique per CPU model and Node.js version.
    • The combination is obfuscated with SHA-256 hash for minor security and ease of result management.
  2. History of test results is stored under test/results in project root by default.
    • See OptiHelper dst_root option.
  3. Upon first run, only benchmark results are shown. This results are called "base".
  4. Upon any subsequent run, OptiHelper also shows different to "base" and "best" ever values.
  5. Benchmark sequence:
    • calibration run (single shot),
    • warmup run based on test_time*warmup_ratio options,
    • actual benchmark for test_time option,
    • after all tests are done, additional benchmark passes may run (pass option).
  6. Optional profiling uses v8-profiler module.
  7. The result is dumped in stdout, but an overall machine readable report is also generated.
  8. process.hrtime() with nanosecond resolution is used.

Usage

  1. Create optihelp.js in your tests folder with Suite of tests.
  2. Run the first ever cycle to get "base" results.
  3. Commit changes and the results.
  4. Create a branch of your project, for example optimization-refdata.
    • It would be helpful when you'll want to add extra tests.
  5. Make optimization and/or other changes
  6. Run the optihelp.js test again and observe the results.

Examples

const optihelp = require('@futoin/optihelp');

optihelp('Suite Name', { test_time : 5, pass : 3 } )
    .test( 'Async Test', (done) => { /* ... */; done() } )
    .test( 'Sync Test', () => { /* ... */; } )
    .start((report) => console.log(report));

API documentation

OptiHelper

Module Optimization Helper

Kind: global class

new OptiHelper(name, options)

C-tor

| Param | Type | Default | Description | | --- | --- | --- | --- | | name | string | | suite name | | options | object | | various options | | options.pass | integer | 2 | how many passes to run | | options.dst_root | string | "'test/results'" | result history folder | | options.test_time | float | 5 | how long to run a single pass of each test in seconds | | options.warmup_ratio | float | 1 | how long to warmup based on test_time | | options.profile_ratio | float | 0.1 | how long to profile based on test_time | | options.bench_delay | float | 1 | benchmark delays after warmup | | options.do_profile | boolean | false | run v8-profiler, if true | | options.check_prod | boolean | true | ensure running in production env | | options.report_file | string | null | store report in file, if true |

optiHelper.test(name, cb) ⇒ OptiHelper

Execute test several times

Kind: instance method of OptiHelper
Returns: OptiHelper - self for chaining

| Param | Type | Description | | --- | --- | --- | | name | string | test name | | cb | callable | test callback |

optiHelper.start(cb)

Start execution of tests

Kind: instance method of OptiHelper

| Param | Type | Description | | --- | --- | --- | | cb | callable | completion callback |