Skip to content

Commit

Permalink
fix: avoid duplicate call to benchmark related callbacks (#134)
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
jerome-benoit and Jérôme Benoit authored Oct 17, 2024
1 parent 50d00d8 commit 581c223
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 173 deletions.
9 changes: 1 addition & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@
"no-await-in-loop": "off",
"no-plusplus": "off",
"no-promise-executor-return": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-types": "off",
"import/no-unresolved": "off",
"import/extensions": "off",
"no-underscore-dangle": "off",
"indent": ["error", 2],
"max-len": 0
"max-len": "off"
}
}
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,22 +333,20 @@ For instance:

```js
// runs on each benchmark task's cycle
bench.addEventListener('cycle', (e) => {
const task = e.task!;
bench.addEventListener('cycle', (evt) => {
const task = evt.task!;
});

// runs only on this benchmark task's cycle
task.addEventListener('cycle', (e) => {
const task = e.task!;
task.addEventListener('cycle', (evt) => {
const task = evt.task!;
});
```

### `BenchEvent`

```ts
export type BenchEvent = Event & {
task: Task | null;
};
export type BenchEvent = Event & { task?: Task };
```

### `process.hrtime`
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "tinybench",
"version": "2.9.0",
"type": "module",
"packageManager": "pnpm@9.12.1",
"packageManager": "pnpm@9.12.2",
"volta": {
"node": "20.18.0",
"pnpm": "9.12.1"
"pnpm": "9.12.2"
},
"engines": {
"node": ">=18.0.0"
Expand Down Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@size-limit/preset-small-lib": "^11.1.6",
"@size-limit/time": "^11.1.6",
"@types/node": "^22.7.5",
"@types/node": "^22.7.6",
"@typescript-eslint/eslint-plugin": "^8.9.0",
"@typescript-eslint/parser": "^8.9.0",
"bumpp": "^9.7.1",
Expand Down
Loading

0 comments on commit 581c223

Please sign in to comment.