per

performancemeter

A simple JavaScript code performance monitor

Showing:

Popularity

Downloads/wk

8

GitHub Stars

8

Maintenance

Last Commit

2yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

1.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Node.js Performance Meter

NPM version NPM downloads MIT License

A simple JavaScript performance meter.

const Meter = require('performancemeter');

// Optional
Meter.name('Bla bla bla');

// Optional, default: "medium" (other types: "veryeasy", "easy", "medium", "hard", "veryhard")
Meter.mode('easy');
// or sets 10 cycles, veryeasy === 100, easy = 100000, medium = 10000000, hard = 10000000000
Meter.mode(10);

// Meter.measure(TEST_NAME, function_test, [function_init]);
// @TEST_NAME {String}
// @function_test {Function}
// @function_init {Function} optional, can contains init values

// Example 1:
Meter.measure('String.indexOf()', 'str.indexOf("meter")', 'var str = "Performance meter"');
Meter.measure('RegExp.test()', 'reg.test(str)', 'var reg = /meter/; var str = "Performance meter');

// Example 2:
Meter.measure('String.indexOf()', () => str.indexOf('meter'), 'var str = "Performance meter"');
Meter.measure('RegExp.test()', () => reg.test(str), 'var reg = /meter/; var str = "Performance meter"');

// Example 3:
Meter.measure('String.indexOf()', function() {
    str.indexOf('meter');
}, function() {
    var str = 'Performance meter';
});

Meter.measure('RegExp.test()', function() {
    reg.test(str);
}, function() {
    var reg = /meter/;
    var str = 'Performance meter';
});

// Async example:
Meter.measure('nextTick', function() {
    process.nextTick(NEXT);
});

Meter.measure('immediate', function() {
    setImmediate(NEXT);
});

Contact

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100