Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bench

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bench - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

examples/array-methods.js

5

examples/func-scope-test.js

@@ -19,2 +19,4 @@ #!/usr/bin/env node

var fnBind = fn.bind(o, 1, 2, 3)
function method () {

@@ -29,5 +31,6 @@ o.method(1,2,3);

, "fn.call()" : fnCall
, "method()" : method
, "o.method()" : method
, "fn.bind()" : fnBind
};
require("../").runMain()

27

lib/bench.js

@@ -11,2 +11,11 @@

var nt_ = typeof setImmediate === 'function' ? setImmediate : process.nextTick
var ntN = 0
function nt(fn) {
if (ntN++ < 100)
return process.nextTick(fn)
nt_(fn)
ntN = 0
}
function runMain () {

@@ -52,3 +61,3 @@ var test = require.main.exports

if (Date.now() > stopTime) return done()
process.nextTick(runner)
nt(runner)
}

@@ -96,3 +105,3 @@ function done () {

} else {
process.nextTick(function () { comparer(currentCompare+1) })
nt(function () { comparer(currentCompare+1) })
}

@@ -103,3 +112,5 @@ })(0)

for (var i = 0; i < testCount; i ++) {
ret[ tests[i].name ] = results[i]
// throw out the first item in each list, since it's usually
// a vm warm-up anyway, and not a valid run.
ret[ tests[i].name ] = results[i].slice(1)
}

@@ -160,2 +171,12 @@ cb(null, ret)

(oom(winner.avg, second.avg)+" order(s) of magnitude faster")
if (pct(winner.avg, second.avg) < 2) print
("BASICALLY THE SAME")
else if (times(winner.avg, second.avg) < 2) print
("A LITTLE FASTER")
else if (oom(winner.avg, second.avg) < 1) print
("QUITE A BIT FASTER")
else print
("A LOT FASTER")
if (loser) print

@@ -162,0 +183,0 @@ ("\nCompared with the slowest ("+loser.name+"), it's:")

@@ -1,7 +0,10 @@

{ "name" : "bench"
, "version" : "0.3.4"
, "description" : "A little utility for doing side-by-side benchmarks in nodejs"
, "author" : "Isaac Z. Schlueter <i@izs.me>"
, "bin" : { "node-bench" : "./lib/cli-wrapper.js" }
, "main" : "lib/bench.js"
{
"name": "bench",
"version": "0.3.5",
"description": "A little utility for doing side-by-side benchmarks in nodejs",
"author": "Isaac Z. Schlueter <i@izs.me>",
"bin": {
"node-bench": "./lib/cli-wrapper.js"
},
"main": "lib/bench.js"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc