Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Simple benchmarking tool with TAP-like output that is easy to parse.
npm install nanobench
var bench = require('nanobench')
bench('sha256 200.000 times', function (b) {
var crypto = require('crypto')
var data = new Buffer('hello world')
b.start()
for (var i = 0; i < 200000; i++) {
data = crypto.createHash('sha256').update(data).digest()
}
b.end()
})
bench('sha1 200.000 times', function (b) {
var crypto = require('crypto')
var data = new Buffer('hello world')
b.start()
for (var i = 0; i < 200000; i++) {
data = crypto.createHash('sha1').update(data).digest()
}
b.end()
})
bench('sha256 200.000 times', function (b) {
var crypto = require('crypto')
var data = new Buffer('hello world')
b.start()
for (var i = 0; i < 200000; i++) {
data = crypto.createHash('sha256').update(data).digest()
}
b.end()
})
Running the above will produce output similar to this:
NANOBENCH version 1
# sha256 200.000 times
end ~568 ms (0 s + 568372106 ns)
# sha1 200.000 times
end ~550 ms (0 s + 550049856 ns)
# sha256 200.000 times
end ~591 ms (0 s + 591365175 ns)
# total ~1.71 s (1 s + 709787137 ns)
# ok
benchmark(name, run)
Add a new benchmark. run
is called with a benchmark object, b
that has the following methods
b.start()
- Start the benchmark. If not called the bench will be tracked from the beginning of the function.b.end()
- End the benchmark.b.error(err)
- Benchmark failed. Report error.benchmark.skip(name, run)
Skip a benchmark.
benchmark.only(name, run)
Only run this benchmark.
If you have multiple benchmarks as different files you can use the cli benchmark runner to run them all
npm install -g nanobench
nanobench benchmarks/*.js
MIT
FAQs
Simple benchmarking tool with TAP-like output that is easy to parse
The npm package nanobench receives a total of 85,552 weekly downloads. As such, nanobench popularity was classified as popular.
We found that nanobench demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.