-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: now we only support non-defer functions, which removes the need to call `done.resolve()` Async ("defer") functions don't really fit the case of micro-benchmarking, they better be tested with e.g Autocannot (runCannon)
- Loading branch information
1 parent
52b60ad
commit 340c16d
Showing
10 changed files
with
54 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import { pDelay, _randomInt } from '@naturalcycles/js-lib' | ||
import { BenchDeferredFunction } from './bench.model' | ||
import { _randomInt } from '@naturalcycles/js-lib' | ||
import { BenchFunction } from './bench.model' | ||
|
||
export const benchNoopFn: BenchDeferredFunction = done => done.resolve() | ||
export const benchNoopFn: BenchFunction = () => {} | ||
|
||
export const benchRandomFn: BenchDeferredFunction = done => { | ||
export const benchRandomFn: BenchFunction = () => { | ||
const _ = _randomInt(1, 10) | ||
done.resolve() | ||
} | ||
|
||
export const benchPDelayFn: BenchDeferredFunction = async done => { | ||
await pDelay() | ||
done.resolve() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,6 @@ | ||
import { BenchDeferredFunction, HertzMap, RunBenchOptions } from './bench.model' | ||
import { benchNoopFn } from './bench.profles' | ||
import { runBench, runBenchScript } from './bench.util' | ||
import { | ||
AutocannonOptions, | ||
AutocannonResult, | ||
AutocannonSummary, | ||
HttpServerFactory, | ||
RunCannonOptions, | ||
} from './cannon.model' | ||
import { | ||
bareExpressServerFactory, | ||
bareNodeServerFactory, | ||
expressFunctionFactory, | ||
expressWithMiddlewaresServerFactory, | ||
} from './cannon.profiles' | ||
import { runCannon, runCannonScript } from './cannon.util' | ||
|
||
export type { | ||
RunBenchOptions, | ||
BenchDeferredFunction, | ||
HertzMap, | ||
HttpServerFactory, | ||
RunCannonOptions, | ||
AutocannonSummary, | ||
AutocannonResult, | ||
AutocannonOptions, | ||
} | ||
|
||
export { | ||
runBenchScript, | ||
runBench, | ||
benchNoopFn, | ||
runCannon, | ||
runCannonScript, | ||
bareNodeServerFactory, | ||
bareExpressServerFactory, | ||
expressWithMiddlewaresServerFactory, | ||
expressFunctionFactory, | ||
} | ||
export * from './bench.model' | ||
export * from './bench.profles' | ||
export * from './bench.util' | ||
export * from './cannon.model' | ||
export * from './cannon.profiles' | ||
export * from './cannon.util' |