Socket
Socket
Sign inDemoInstall

@indutny/bencher

Package Overview
Dependencies
16
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

38

dist/bin/bencher.js

@@ -26,10 +26,40 @@ #!/usr/bin/env node

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const promises_1 = require("fs/promises");
const yargs_1 = __importDefault(require("yargs"));
const helpers_1 = require("yargs/helpers");
async function main() {
const modules = await Promise.all(process.argv.slice(2).map(async (file) => {
const argv = await (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
.alias('h', 'help')
.option('d', {
alias: 'duration',
type: 'number',
default: 5,
describe: 'maximum duration in seconds per runner',
})
.option('s', {
alias: 'samples',
type: 'number',
default: 100,
describe: 'number of samples to collect per runner',
})
.option('w', {
alias: 'sweep-width',
type: 'number',
default: 10,
describe: 'width of iteration sweep',
})
.option('warm-up-iterations', {
type: 'number',
default: 100,
describe: 'number of warm up iterations',
}).argv;
const modules = await Promise.all(argv._.map(async (file) => {
var _a;
const path = await (0, promises_1.realpath)(file);
const path = await (0, promises_1.realpath)(String(file));
const m = await (_a = path, Promise.resolve().then(() => __importStar(require(_a))));
const { duration = 5, sweepWidth = 10, samples = 100, warmUpIterations = 100, } = m.options ?? {};
const { duration = argv['duration'], sweepWidth = argv['sweepWidth'], samples = argv['samples'], warmUpIterations = argv['warmUpIterations'], } = m.options ?? {};
if (duration <= 0) {

@@ -51,3 +81,3 @@ throw new Error(`${file}: options.duration must be positive`);

return {
name: m.name ?? file,
name: m.name ?? String(file),
options: {

@@ -54,0 +84,0 @@ duration,

{
"name": "@indutny/bencher",
"version": "1.0.0",
"version": "1.1.0",
"description": "Simple benchmarking tool",

@@ -35,2 +35,3 @@ "bin": {

"devDependencies": {
"@types/yargs": "^17.0.17",
"@typescript-eslint/eslint-plugin": "^5.47.0",

@@ -42,3 +43,6 @@ "@typescript-eslint/parser": "^5.47.0",

"typescript": "^4.9.4"
},
"dependencies": {
"yargs": "^17.6.2"
}
}

2

README.md

@@ -28,3 +28,3 @@ # @indutny/bencher

// benchmark.js
export const name = 'benchmark name';
export const name = 'runner';

@@ -31,0 +31,0 @@ // Function to benchmark

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc