Skip to content

Commit

Permalink
fix(bench): update timedResult() to always downscale to ms
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 3, 2020
1 parent 6494851 commit fb2c632
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/bench/src/timed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const timed = <T>(fn: () => T, prefix = "") => {

/**
* Similar to {@link timed}, but produces no output and instead returns
* tuple of `fn`'s result and the time measurement.
* tuple of `fn`'s result and the time measurement (in milliseconds).
*
* @param fn - function to time
*/
Expand All @@ -27,8 +27,8 @@ export const timedResult = <T>(fn: () => T): TimingResult<T> => {
const t1 = now();
return [
res,
typeof BigInt !== "undefined"
? Number(<bigint>t1 - <bigint>t0) * 1e-6
: <number>t1 - <number>t0
(typeof BigInt !== "undefined"
? Number(<bigint>t1 - <bigint>t0)
: <number>t1 - <number>t0) * 1e-6,
];
};

0 comments on commit fb2c632

Please sign in to comment.