overtake 1.0.0-rc.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.cjs +7 -7
- package/build/cli.cjs.map +1 -1
- package/build/cli.js +1 -1
- package/build/cli.js.map +1 -1
- package/build/index.cjs +227 -11
- package/build/index.cjs.map +1 -1
- package/build/index.d.ts +65 -3
- package/build/index.js +186 -1
- package/build/index.js.map +1 -1
- package/build/reporter.cjs +4 -4
- package/build/reporter.cjs.map +1 -1
- package/build/reporter.js +1 -1
- package/build/reporter.js.map +1 -1
- package/build/types.cjs +6 -6
- package/build/types.cjs.map +1 -1
- package/build/utils.cjs +9 -9
- package/build/utils.cjs.map +1 -1
- package/build/utils.js +1 -1
- package/build/utils.js.map +1 -1
- package/examples/array-copy.ts +17 -0
- package/examples/object-merge.ts +41 -0
- package/package.json +19 -21
- package/src/cli.ts +2 -2
- package/src/index.ts +232 -3
- package/src/reporter.ts +1 -1
- package/src/utils.ts +1 -1
- package/build/__tests__/runner.d.ts +0 -1
- package/build/benchmark.cjs +0 -237
- package/build/benchmark.cjs.map +0 -1
- package/build/benchmark.d.ts +0 -64
- package/build/benchmark.js +0 -189
- package/build/benchmark.js.map +0 -1
- package/overtakes/array-copy.md +0 -80
- package/overtakes/array-delete-element.md +0 -44
- package/overtakes/async.md +0 -25
- package/overtakes/class-vs-function.md +0 -31
- package/overtakes/postgres-vs-mongo.md +0 -55
- package/src/__tests__/runner.ts +0 -34
- package/src/benchmark.ts +0 -231
package/build/benchmark.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { cpus } from 'node:os';
|
|
2
|
-
import { createExecutor } from "./executor.js";
|
|
3
|
-
import { DEFAULT_CYCLES } from "./types.js";
|
|
4
|
-
export const DEFAULT_WORKERS = cpus().length;
|
|
5
|
-
export const AsyncFunction = (async ()=>{}).constructor;
|
|
6
|
-
export const DEFAULT_REPORT_TYPES = [
|
|
7
|
-
'ops'
|
|
8
|
-
];
|
|
9
|
-
export class MeasureContext {
|
|
10
|
-
title;
|
|
11
|
-
run;
|
|
12
|
-
pre;
|
|
13
|
-
post;
|
|
14
|
-
constructor(title, run){
|
|
15
|
-
this.title = title;
|
|
16
|
-
this.run = run;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export class Measure {
|
|
20
|
-
#ctx;
|
|
21
|
-
constructor(ctx){
|
|
22
|
-
this.#ctx = ctx;
|
|
23
|
-
}
|
|
24
|
-
pre(fn) {
|
|
25
|
-
this.#ctx.pre = fn;
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
post(fn) {
|
|
29
|
-
this.#ctx.post = fn;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export class TargetContext {
|
|
34
|
-
title;
|
|
35
|
-
setup;
|
|
36
|
-
teardown;
|
|
37
|
-
measures;
|
|
38
|
-
constructor(title, setup){
|
|
39
|
-
this.title = title;
|
|
40
|
-
this.setup = setup;
|
|
41
|
-
this.measures = [];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export class Target {
|
|
45
|
-
#ctx;
|
|
46
|
-
constructor(ctx){
|
|
47
|
-
this.#ctx = ctx;
|
|
48
|
-
}
|
|
49
|
-
teardown(fn) {
|
|
50
|
-
this.#ctx.teardown = fn;
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
measure(title, run) {
|
|
54
|
-
const measure = new MeasureContext(title, run);
|
|
55
|
-
this.#ctx.measures.push(measure);
|
|
56
|
-
return new Measure(measure);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export class FeedContext {
|
|
60
|
-
title;
|
|
61
|
-
fn;
|
|
62
|
-
constructor(title, fn){
|
|
63
|
-
this.title = title;
|
|
64
|
-
this.fn = fn;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
export class Benchmark {
|
|
68
|
-
#targets = [];
|
|
69
|
-
#feeds = [];
|
|
70
|
-
#executed = false;
|
|
71
|
-
static create(title, fn) {
|
|
72
|
-
if (fn) {
|
|
73
|
-
return new Benchmark(title, fn);
|
|
74
|
-
} else {
|
|
75
|
-
return new Benchmark(title);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
constructor(title, fn){
|
|
79
|
-
if (fn) {
|
|
80
|
-
this.feed(title, fn);
|
|
81
|
-
} else {
|
|
82
|
-
this.feed(title);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
feed(title, fn) {
|
|
86
|
-
const self = this;
|
|
87
|
-
self.#feeds.push(fn ? new FeedContext(title, fn) : new FeedContext(title));
|
|
88
|
-
return self;
|
|
89
|
-
}
|
|
90
|
-
target(title, setup) {
|
|
91
|
-
const target = new TargetContext(title, setup);
|
|
92
|
-
this.#targets.push(target);
|
|
93
|
-
return new Target(target);
|
|
94
|
-
}
|
|
95
|
-
async execute({ workers = DEFAULT_WORKERS, warmupCycles = 20, maxCycles = DEFAULT_CYCLES, minCycles = 50, absThreshold = 1_000, relThreshold = 0.02, reportTypes = DEFAULT_REPORT_TYPES }) {
|
|
96
|
-
if (this.#executed) {
|
|
97
|
-
throw new Error("Benchmark is executed and can't be reused");
|
|
98
|
-
}
|
|
99
|
-
this.#executed = true;
|
|
100
|
-
const executor = createExecutor({
|
|
101
|
-
workers,
|
|
102
|
-
warmupCycles,
|
|
103
|
-
maxCycles,
|
|
104
|
-
minCycles,
|
|
105
|
-
absThreshold,
|
|
106
|
-
relThreshold,
|
|
107
|
-
reportTypes
|
|
108
|
-
});
|
|
109
|
-
const reports = [];
|
|
110
|
-
for (const target of this.#targets){
|
|
111
|
-
const targetReport = {
|
|
112
|
-
target: target.title,
|
|
113
|
-
measures: []
|
|
114
|
-
};
|
|
115
|
-
for (const measure of target.measures){
|
|
116
|
-
const measureReport = {
|
|
117
|
-
measure: measure.title,
|
|
118
|
-
feeds: []
|
|
119
|
-
};
|
|
120
|
-
for (const feed of this.#feeds){
|
|
121
|
-
const data = await feed.fn?.();
|
|
122
|
-
executor.push({
|
|
123
|
-
setup: target.setup,
|
|
124
|
-
teardown: target.teardown,
|
|
125
|
-
pre: measure.pre,
|
|
126
|
-
run: measure.run,
|
|
127
|
-
post: measure.post,
|
|
128
|
-
data
|
|
129
|
-
}).then((data)=>{
|
|
130
|
-
measureReport.feeds.push({
|
|
131
|
-
feed: feed.title,
|
|
132
|
-
data
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
targetReport.measures.push(measureReport);
|
|
137
|
-
}
|
|
138
|
-
reports.push(targetReport);
|
|
139
|
-
}
|
|
140
|
-
await executor.drain();
|
|
141
|
-
executor.kill();
|
|
142
|
-
return reports;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
export const printSimpleReports = (reports)=>{
|
|
146
|
-
for (const report of reports){
|
|
147
|
-
for (const { measure, feeds } of report.measures){
|
|
148
|
-
console.group('\n', report.target, measure);
|
|
149
|
-
for (const { feed, data } of feeds){
|
|
150
|
-
const output = Object.entries(data).map(([key, report])=>`${key}: ${report.toString()}`).join('; ');
|
|
151
|
-
console.log(feed, output);
|
|
152
|
-
}
|
|
153
|
-
console.groupEnd();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
export const printTableReports = (reports)=>{
|
|
158
|
-
for (const report of reports){
|
|
159
|
-
for (const { measure, feeds } of report.measures){
|
|
160
|
-
console.log('\n', report.target, measure);
|
|
161
|
-
const table = {};
|
|
162
|
-
for (const { feed, data } of feeds){
|
|
163
|
-
table[feed] = Object.fromEntries(Object.entries(data).map(([key, report])=>[
|
|
164
|
-
key,
|
|
165
|
-
report.toString()
|
|
166
|
-
]));
|
|
167
|
-
}
|
|
168
|
-
console.table(table);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
export const printJSONReports = (reports, padding)=>{
|
|
173
|
-
const output = {};
|
|
174
|
-
for (const report of reports){
|
|
175
|
-
for (const { measure, feeds } of report.measures){
|
|
176
|
-
const row = {};
|
|
177
|
-
for (const { feed, data } of feeds){
|
|
178
|
-
row[feed] = Object.fromEntries(Object.entries(data).map(([key, report])=>[
|
|
179
|
-
key,
|
|
180
|
-
report.toString()
|
|
181
|
-
]));
|
|
182
|
-
}
|
|
183
|
-
output[`${report.target} ${measure}`] = row;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
console.log(JSON.stringify(output, null, padding));
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
//# sourceMappingURL=benchmark.js.map
|
package/build/benchmark.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/benchmark.ts"],"sourcesContent":["import { cpus } from 'node:os';\nimport { createExecutor, ExecutorOptions, ExecutorReport } from './executor.js';\nimport { MaybePromise, StepFn, SetupFn, TeardownFn, FeedFn, ReportType, ReportTypeList, DEFAULT_CYCLES } from './types.js';\n\nexport const DEFAULT_WORKERS = cpus().length;\n\nexport const AsyncFunction = (async () => {}).constructor;\n\nexport interface TargetReport<R extends ReportTypeList> {\n target: string;\n measures: MeasureReport<R>[];\n}\n\nexport interface MeasureReport<R extends ReportTypeList> {\n measure: string;\n feeds: FeedReport<R>[];\n}\n\nexport interface FeedReport<R extends ReportTypeList> {\n feed: string;\n data: ExecutorReport<R>;\n}\n\nexport const DEFAULT_REPORT_TYPES = ['ops'] as const;\nexport type DefaultReportTypes = (typeof DEFAULT_REPORT_TYPES)[number];\n\nexport class MeasureContext<TContext, TInput> {\n public pre?: StepFn<TContext, TInput>;\n public post?: StepFn<TContext, TInput>;\n\n constructor(\n public title: string,\n public run: StepFn<TContext, TInput>,\n ) {}\n}\n\nexport class Measure<TContext, TInput> {\n #ctx: MeasureContext<TContext, TInput>;\n\n constructor(ctx: MeasureContext<TContext, TInput>) {\n this.#ctx = ctx;\n }\n\n pre(fn: StepFn<TContext, TInput>): Measure<TContext, TInput> {\n this.#ctx.pre = fn;\n return this;\n }\n post(fn: StepFn<TContext, TInput>): Measure<TContext, TInput> {\n this.#ctx.post = fn;\n return this;\n }\n}\n\nexport class TargetContext<TContext, TInput> {\n public teardown?: TeardownFn<TContext>;\n public measures: MeasureContext<TContext, TInput>[] = [];\n\n constructor(\n readonly title: string,\n readonly setup?: SetupFn<MaybePromise<TContext>>,\n ) {}\n}\n\nexport class Target<TContext, TInput> {\n #ctx: TargetContext<TContext, TInput>;\n\n constructor(ctx: TargetContext<TContext, TInput>) {\n this.#ctx = ctx;\n }\n teardown(fn: TeardownFn<TContext>): Target<TContext, TInput> {\n this.#ctx.teardown = fn;\n\n return this;\n }\n measure(title: string, run: StepFn<TContext, TInput>): Measure<TContext, TInput> {\n const measure = new MeasureContext(title, run);\n this.#ctx.measures.push(measure);\n\n return new Measure(measure);\n }\n}\n\nexport class FeedContext<TInput> {\n constructor(\n readonly title: string,\n readonly fn?: FeedFn<TInput>,\n ) {}\n}\n\nexport class Benchmark<TInput> {\n #targets: TargetContext<unknown, TInput>[] = [];\n #feeds: FeedContext<TInput>[] = [];\n #executed = false;\n\n static create(title: string): Benchmark<void>;\n static create<I>(title: string, fn: FeedFn<I>): Benchmark<I>;\n static create<I>(title: string, fn?: FeedFn<I> | undefined): Benchmark<I> {\n if (fn) {\n return new Benchmark(title, fn);\n } else {\n return new Benchmark(title);\n }\n }\n\n constructor(title: string);\n constructor(title: string, fn: FeedFn<TInput>);\n constructor(title: string, fn?: FeedFn<TInput> | undefined) {\n if (fn) {\n this.feed(title, fn);\n } else {\n this.feed(title);\n }\n }\n\n feed(title: string): Benchmark<TInput | void>;\n feed<I>(title: string, fn: FeedFn<I>): Benchmark<TInput | I>;\n feed<I>(title: string, fn?: FeedFn<I> | undefined): Benchmark<TInput | I> {\n const self = this as Benchmark<TInput | I>;\n self.#feeds.push(fn ? new FeedContext(title, fn) : new FeedContext(title));\n\n return self;\n }\n\n target<TContext>(title: string): Target<void, TInput>;\n target<TContext>(title: string, setup: SetupFn<Awaited<TContext>>): Target<TContext, TInput>;\n target<TContext>(title: string, setup?: SetupFn<Awaited<TContext>> | undefined): Target<TContext, TInput> {\n const target = new TargetContext<TContext, TInput>(title, setup);\n this.#targets.push(target as TargetContext<unknown, TInput>);\n\n return new Target<TContext, TInput>(target);\n }\n\n async execute<R extends readonly ReportType[] = typeof DEFAULT_REPORT_TYPES>({\n workers = DEFAULT_WORKERS,\n warmupCycles = 20,\n maxCycles = DEFAULT_CYCLES,\n minCycles = 50,\n absThreshold = 1_000,\n relThreshold = 0.02,\n reportTypes = DEFAULT_REPORT_TYPES as unknown as R,\n }: ExecutorOptions<R>): Promise<TargetReport<R>[]> {\n if (this.#executed) {\n throw new Error(\"Benchmark is executed and can't be reused\");\n }\n this.#executed = true;\n\n const executor = createExecutor<unknown, TInput, R>({\n workers,\n warmupCycles,\n maxCycles,\n minCycles,\n absThreshold,\n relThreshold,\n reportTypes,\n });\n\n const reports: TargetReport<R>[] = [];\n for (const target of this.#targets) {\n const targetReport: TargetReport<R> = { target: target.title, measures: [] };\n for (const measure of target.measures) {\n const measureReport: MeasureReport<R> = { measure: measure.title, feeds: [] };\n for (const feed of this.#feeds) {\n const data = await feed.fn?.();\n executor\n .push<ExecutorReport<R>>({\n setup: target.setup,\n teardown: target.teardown,\n pre: measure.pre,\n run: measure.run,\n post: measure.post,\n data,\n })\n .then((data) => {\n measureReport.feeds.push({\n feed: feed.title,\n data,\n });\n });\n }\n targetReport.measures.push(measureReport);\n }\n reports.push(targetReport);\n }\n await executor.drain();\n executor.kill();\n\n return reports;\n }\n}\n\nexport const printSimpleReports = <R extends ReportTypeList>(reports: TargetReport<R>[]) => {\n for (const report of reports) {\n for (const { measure, feeds } of report.measures) {\n console.group('\\n', report.target, measure);\n for (const { feed, data } of feeds) {\n const output = Object.entries(data)\n .map(([key, report]) => `${key}: ${report.toString()}`)\n .join('; ');\n console.log(feed, output);\n }\n console.groupEnd();\n }\n }\n};\n\nexport const printTableReports = <R extends ReportTypeList>(reports: TargetReport<R>[]) => {\n for (const report of reports) {\n for (const { measure, feeds } of report.measures) {\n console.log('\\n', report.target, measure);\n const table: Record<string, unknown> = {};\n for (const { feed, data } of feeds) {\n table[feed] = Object.fromEntries(Object.entries(data).map(([key, report]) => [key, report.toString()]));\n }\n console.table(table);\n }\n }\n};\n\nexport const printJSONReports = <R extends ReportTypeList>(reports: TargetReport<R>[], padding?: number) => {\n const output = {} as Record<string, Record<string, Record<string, string>>>;\n for (const report of reports) {\n for (const { measure, feeds } of report.measures) {\n const row = {} as Record<string, Record<string, string>>;\n for (const { feed, data } of feeds) {\n row[feed] = Object.fromEntries(Object.entries(data).map(([key, report]) => [key, report.toString()]));\n }\n output[`${report.target} ${measure}`] = row;\n }\n }\n console.log(JSON.stringify(output, null, padding));\n};\n"],"names":["cpus","createExecutor","DEFAULT_CYCLES","DEFAULT_WORKERS","length","AsyncFunction","constructor","DEFAULT_REPORT_TYPES","MeasureContext","pre","post","title","run","Measure","ctx","fn","TargetContext","teardown","measures","setup","Target","measure","push","FeedContext","Benchmark","create","feed","self","target","execute","workers","warmupCycles","maxCycles","minCycles","absThreshold","relThreshold","reportTypes","Error","executor","reports","targetReport","measureReport","feeds","data","then","drain","kill","printSimpleReports","report","console","group","output","Object","entries","map","key","toString","join","log","groupEnd","printTableReports","table","fromEntries","printJSONReports","padding","row","JSON","stringify"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAC/B,SAASC,cAAc,QAAyC,gBAAgB;AAChF,SAAwFC,cAAc,QAAQ,aAAa;AAE3H,OAAO,MAAMC,kBAAkBH,OAAOI,MAAM,CAAC;AAE7C,OAAO,MAAMC,gBAAgB,AAAC,CAAA,WAAa,CAAA,EAAGC,WAAW,CAAC;AAiB1D,OAAO,MAAMC,uBAAuB;IAAC;CAAM,CAAU;AAGrD,OAAO,MAAMC;;;IACJC,IAA+B;IAC/BC,KAAgC;IAEvCJ,YACE,AAAOK,KAAa,EACpB,AAAOC,GAA6B,CACpC;aAFOD,QAAAA;aACAC,MAAAA;IACN;AACL;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GAAG,CAAC,MAAMV,OAAOpB,MAAM,EAAEP;YACjC,MAAMwC,QAAiC,CAAC;YACxC,KAAK,MAAM,EAAEnC,IAAI,EAAEiB,IAAI,EAAE,IAAID,MAAO;gBAClCmB,KAAK,CAACnC,KAAK,GAAG0B,OAAOU,WAAW,CAACV,OAAOC,OAAO,CAACV,MAAMW,GAAG,CAAC,CAAC,CAACC,KAAKP,OAAO,GAAK;wBAACO;wBAAKP,OAAOQ,QAAQ;qBAAG;YACvG;YACAP,QAAQY,KAAK,CAACA;QAChB;IACF;AACF,EAAE;AAEF,OAAO,MAAME,mBAAmB,CAA2BxB,SAA4ByB;IACrF,MAAMb,SAAS,CAAC;IAChB,KAAK,MAAMH,UAAUT,QAAS;QAC5B,KAAK,MAAM,EAAElB,OAAO,EAAEqB,KAAK,EAAE,IAAIM,OAAO9B,QAAQ,CAAE;YAChD,MAAM+C,MAAM,CAAC;YACb,KAAK,MAAM,EAAEvC,IAAI,EAAEiB,IAAI,EAAE,IAAID,MAAO;gBAClCuB,GAAG,CAACvC,KAAK,GAAG0B,OAAOU,WAAW,CAACV,OAAOC,OAAO,CAACV,MAAMW,GAAG,CAAC,CAAC,CAACC,KAAKP,OAAO,GAAK;wBAACO;wBAAKP,OAAOQ,QAAQ;qBAAG;YACrG;YACAL,MAAM,CAAC,GAAGH,OAAOpB,MAAM,CAAC,CAAC,EAAEP,SAAS,CAAC,GAAG4C;QAC1C;IACF;IACAhB,QAAQS,GAAG,CAACQ,KAAKC,SAAS,CAAChB,QAAQ,MAAMa;AAC3C,EAAE"}
|
package/overtakes/array-copy.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Array copy methods
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
⭐ Script __benchmarks__/array-copy.js
|
|
5
|
-
⇶ Suite Array copy methods
|
|
6
|
-
➤ Perform 10 elements
|
|
7
|
-
✓ Measure 500000 slice
|
|
8
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
9
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
10
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
11
|
-
│ 0.000059 │ 0.000065 │ 0.000105 │ 0.000241 │ 50.160222 │ 500000 │
|
|
12
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
13
|
-
✓ Measure 500000 spread
|
|
14
|
-
┌──────────┬──────────┬──────────┬──────────┬──────────┬────────┐
|
|
15
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
16
|
-
├──────────┼──────────┼──────────┼──────────┼──────────┼────────┤
|
|
17
|
-
│ 0.000061 │ 0.000067 │ 0.000087 │ 0.000193 │ 44.70032 │ 500000 │
|
|
18
|
-
└──────────┴──────────┴──────────┴──────────┴──────────┴────────┘
|
|
19
|
-
✓ Measure 500000 concat
|
|
20
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
21
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
22
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
23
|
-
│ 0.000061 │ 0.000068 │ 0.000119 │ 0.000234 │ 40.695219 │ 500000 │
|
|
24
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
25
|
-
✓ Measure 500000 Array.from
|
|
26
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
27
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
28
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
29
|
-
│ 0.000065 │ 0.000072 │ 0.000126 │ 0.000237 │ 50.390629 │ 500000 │
|
|
30
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
31
|
-
✓ Measure 500000 for loop assign
|
|
32
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
33
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
34
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
35
|
-
│ 0.000066 │ 0.000071 │ 0.000126 │ 0.000287 │ 43.803009 │ 500000 │
|
|
36
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
37
|
-
✓ Measure 500000 for loop push
|
|
38
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
39
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
40
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
41
|
-
│ 0.000065 │ 0.000072 │ 0.000142 │ 0.000284 │ 43.769935 │ 500000 │
|
|
42
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
43
|
-
➤ Perform 1000 elements
|
|
44
|
-
✓ Measure 500000 slice
|
|
45
|
-
┌─────────┬──────────┬──────────┬──────────┬────────────┬────────┐
|
|
46
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
47
|
-
├─────────┼──────────┼──────────┼──────────┼────────────┼────────┤
|
|
48
|
-
│ 0.00011 │ 0.000182 │ 0.000371 │ 0.000601 │ 186.871627 │ 500000 │
|
|
49
|
-
└─────────┴──────────┴──────────┴──────────┴────────────┴────────┘
|
|
50
|
-
✓ Measure 500000 spread
|
|
51
|
-
┌──────────┬──────────┬──────────┬──────────┬────────────┬────────┐
|
|
52
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
53
|
-
├──────────┼──────────┼──────────┼──────────┼────────────┼────────┤
|
|
54
|
-
│ 0.000113 │ 0.000186 │ 0.000362 │ 0.000577 │ 186.106348 │ 500000 │
|
|
55
|
-
└──────────┴──────────┴──────────┴──────────┴────────────┴────────┘
|
|
56
|
-
✓ Measure 500000 concat
|
|
57
|
-
┌──────────┬──────────┬──────────┬──────────┬────────────┬────────┐
|
|
58
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
59
|
-
├──────────┼──────────┼──────────┼──────────┼────────────┼────────┤
|
|
60
|
-
│ 0.000116 │ 0.000199 │ 0.000445 │ 0.000772 │ 204.249913 │ 500000 │
|
|
61
|
-
└──────────┴──────────┴──────────┴──────────┴────────────┴────────┘
|
|
62
|
-
✓ Measure 500000 Array.from
|
|
63
|
-
┌──────────┬─────────┬──────────┬──────────┬────────────┬────────┐
|
|
64
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
65
|
-
├──────────┼─────────┼──────────┼──────────┼────────────┼────────┤
|
|
66
|
-
│ 0.000113 │ 0.00019 │ 0.000347 │ 0.000564 │ 190.512575 │ 500000 │
|
|
67
|
-
└──────────┴─────────┴──────────┴──────────┴────────────┴────────┘
|
|
68
|
-
✓ Measure 500000 for loop assign
|
|
69
|
-
┌──────────┬──────────┬──────────┬─────────┬────────────┬────────┐
|
|
70
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
71
|
-
├──────────┼──────────┼──────────┼─────────┼────────────┼────────┤
|
|
72
|
-
│ 0.002016 │ 0.002428 │ 0.003344 │ 0.00437 │ 1477.99805 │ 500000 │
|
|
73
|
-
└──────────┴──────────┴──────────┴─────────┴────────────┴────────┘
|
|
74
|
-
✓ Measure 500000 for loop push
|
|
75
|
-
┌──────────┬──────────┬──────────┬──────────┬─────────────┬────────┐
|
|
76
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
77
|
-
├──────────┼──────────┼──────────┼──────────┼─────────────┼────────┤
|
|
78
|
-
│ 0.002343 │ 0.002756 │ 0.003774 │ 0.006158 │ 1687.568837 │ 500000 │
|
|
79
|
-
└──────────┴──────────┴──────────┴──────────┴─────────────┴────────┘
|
|
80
|
-
```
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Array delete element
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
⭐ Script __benchmarks__/array-delete-element.js
|
|
5
|
-
⇶ Suite Array delete element methods
|
|
6
|
-
➤ Perform 10 elements
|
|
7
|
-
✓ Measure 500000 splice
|
|
8
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
9
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
10
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
11
|
-
│ 0.000072 │ 0.000078 │ 0.000121 │ 0.000248 │ 57.628642 │ 500000 │
|
|
12
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
13
|
-
✓ Measure 500000 filter
|
|
14
|
-
┌──────────┬──────────┬─────────┬──────────┬───────────┬────────┐
|
|
15
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
16
|
-
├──────────┼──────────┼─────────┼──────────┼───────────┼────────┤
|
|
17
|
-
│ 0.000067 │ 0.000077 │ 0.00018 │ 0.000303 │ 51.695539 │ 500000 │
|
|
18
|
-
└──────────┴──────────┴─────────┴──────────┴───────────┴────────┘
|
|
19
|
-
✓ Measure 500000 for loop
|
|
20
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
21
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
22
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
23
|
-
│ 0.000064 │ 0.000074 │ 0.000119 │ 0.000307 │ 44.446428 │ 500000 │
|
|
24
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
25
|
-
➤ Perform 1000 elements
|
|
26
|
-
✓ Measure 500000 splice
|
|
27
|
-
┌─────────┬──────────┬──────────┬──────────┬───────────┬────────┐
|
|
28
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
29
|
-
├─────────┼──────────┼──────────┼──────────┼───────────┼────────┤
|
|
30
|
-
│ 0.00007 │ 0.000076 │ 0.000121 │ 0.000268 │ 54.328497 │ 500000 │
|
|
31
|
-
└─────────┴──────────┴──────────┴──────────┴───────────┴────────┘
|
|
32
|
-
✓ Measure 500000 filter
|
|
33
|
-
┌──────────┬──────────┬──────────┬─────────┬────────────┬────────┐
|
|
34
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
35
|
-
├──────────┼──────────┼──────────┼─────────┼────────────┼────────┤
|
|
36
|
-
│ 0.002064 │ 0.002521 │ 0.003448 │ 0.00804 │ 1571.98239 │ 500000 │
|
|
37
|
-
└──────────┴──────────┴──────────┴─────────┴────────────┴────────┘
|
|
38
|
-
✓ Measure 500000 for loop
|
|
39
|
-
┌──────────┬──────────┬──────────┬─────────┬─────────────┬────────┐
|
|
40
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
41
|
-
├──────────┼──────────┼──────────┼─────────┼─────────────┼────────┤
|
|
42
|
-
│ 0.002166 │ 0.002625 │ 0.003383 │ 0.00448 │ 1578.507514 │ 500000 │
|
|
43
|
-
└──────────┴──────────┴──────────┴─────────┴─────────────┴────────┘
|
|
44
|
-
```
|
package/overtakes/async.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Async functions call performance
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
⭐ Script __benchmarks__/async.js
|
|
5
|
-
⇶ Suite Async functions performance
|
|
6
|
-
➤ Perform 10000000 calls
|
|
7
|
-
✓ Measure 10000000 calls of function that returns Promise.resolve()
|
|
8
|
-
┌─────────┬──────────┬──────────┬─────────┬─────────────┬──────────┐
|
|
9
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
10
|
-
├─────────┼──────────┼──────────┼─────────┼─────────────┼──────────┤
|
|
11
|
-
│ 0.00008 │ 0.000093 │ 0.000138 │ 0.00023 │ 1189.475052 │ 10000000 │
|
|
12
|
-
└─────────┴──────────┴──────────┴─────────┴─────────────┴──────────┘
|
|
13
|
-
✓ Measure 10000000 calls of async function that returns await Promise.resolve()
|
|
14
|
-
┌──────────┬──────────┬──────────┬──────────┬─────────────┬──────────┐
|
|
15
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
16
|
-
├──────────┼──────────┼──────────┼──────────┼─────────────┼──────────┤
|
|
17
|
-
│ 0.000108 │ 0.000122 │ 0.000267 │ 0.000389 │ 1735.581918 │ 10000000 │
|
|
18
|
-
└──────────┴──────────┴──────────┴──────────┴─────────────┴──────────┘
|
|
19
|
-
✓ Measure 10000000 calls of async function that returns Promise.resolve()
|
|
20
|
-
┌──────────┬──────────┬──────────┬──────────┬─────────────┬──────────┐
|
|
21
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
22
|
-
├──────────┼──────────┼──────────┼──────────┼─────────────┼──────────┤
|
|
23
|
-
│ 0.000105 │ 0.000125 │ 0.000203 │ 0.000333 │ 1557.773513 │ 10000000 │
|
|
24
|
-
└──────────┴──────────┴──────────┴──────────┴─────────────┴──────────┘
|
|
25
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Class vs Function
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
⭐ Script __benchmarks__/class-vs-function.js
|
|
5
|
-
⇶ Suite Class vs Function
|
|
6
|
-
➤ Perform Instantiation
|
|
7
|
-
✓ Measure 1000000 class declarations via "class"
|
|
8
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬─────────┐
|
|
9
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
10
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼─────────┤
|
|
11
|
-
│ 0.000438 │ 0.000496 │ 0.001133 │ 0.001602 │ 684.87052 │ 1000000 │
|
|
12
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴─────────┘
|
|
13
|
-
✓ Measure 1000000 instantiations of the declared class via class and test method call
|
|
14
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬─────────┐
|
|
15
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
16
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼─────────┤
|
|
17
|
-
│ 0.000048 │ 0.000054 │ 0.000059 │ 0.000137 │ 61.055298 │ 1000000 │
|
|
18
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴─────────┘
|
|
19
|
-
✓ Measure 1000000 class declarations via function
|
|
20
|
-
┌─────────┬──────────┬─────────┬──────────┬──────────┬─────────┐
|
|
21
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
22
|
-
├─────────┼──────────┼─────────┼──────────┼──────────┼─────────┤
|
|
23
|
-
│ 0.00005 │ 0.000056 │ 0.00007 │ 0.000146 │ 63.94922 │ 1000000 │
|
|
24
|
-
└─────────┴──────────┴─────────┴──────────┴──────────┴─────────┘
|
|
25
|
-
✓ Measure 1000000 instantiations of the declared class via function and test method call
|
|
26
|
-
┌──────────┬──────────┬─────────┬──────────┬───────────┬─────────┐
|
|
27
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
28
|
-
├──────────┼──────────┼─────────┼──────────┼───────────┼─────────┤
|
|
29
|
-
│ 0.000049 │ 0.000056 │ 0.00008 │ 0.000189 │ 78.511849 │ 1000000 │
|
|
30
|
-
└──────────┴──────────┴─────────┴──────────┴───────────┴─────────┘
|
|
31
|
-
```
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
### Postgres vs MongoDB
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
⭐ Script __benchmarks__/postgres-vs-mongo.js
|
|
5
|
-
⇶ Suite mongodb vs postgres
|
|
6
|
-
➤ Perform simple test
|
|
7
|
-
✓ Measure 1000 postgres inserts
|
|
8
|
-
┌──────────┬──────────┬──────────┬─────────┬─────────────┬───────┐
|
|
9
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
10
|
-
├──────────┼──────────┼──────────┼─────────┼─────────────┼───────┤
|
|
11
|
-
│ 2.232527 │ 2.256009 │ 2.917856 │ 5.41444 │ 2408.708534 │ 1000 │
|
|
12
|
-
└──────────┴──────────┴──────────┴─────────┴─────────────┴───────┘
|
|
13
|
-
✓ Measure 1000 mongodb inserts
|
|
14
|
-
┌──────────┬──────────┬──────────┬──────────┬─────────────┬───────┐
|
|
15
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
16
|
-
├──────────┼──────────┼──────────┼──────────┼─────────────┼───────┤
|
|
17
|
-
│ 2.955035 │ 2.981828 │ 5.038826 │ 5.467477 │ 3233.680552 │ 1000 │
|
|
18
|
-
└──────────┴──────────┴──────────┴──────────┴─────────────┴───────┘
|
|
19
|
-
✓ Measure 1000 postgres query data
|
|
20
|
-
┌─────────┬──────────┬──────────┬──────────┬────────────┬───────┐
|
|
21
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
22
|
-
├─────────┼──────────┼──────────┼──────────┼────────────┼───────┤
|
|
23
|
-
│ 0.28218 │ 0.297544 │ 0.393615 │ 0.561729 │ 308.713494 │ 1000 │
|
|
24
|
-
└─────────┴──────────┴──────────┴──────────┴────────────┴───────┘
|
|
25
|
-
✓ Measure 1000 mongodb query data
|
|
26
|
-
┌──────────┬──────────┬──────────┬──────────┬───────────┬───────┐
|
|
27
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
28
|
-
├──────────┼──────────┼──────────┼──────────┼───────────┼───────┤
|
|
29
|
-
│ 0.457289 │ 0.461665 │ 0.693627 │ 0.919116 │ 495.27099 │ 1000 │
|
|
30
|
-
└──────────┴──────────┴──────────┴──────────┴───────────┴───────┘
|
|
31
|
-
✓ Measure 1000 postgres query inserts
|
|
32
|
-
┌──────────┬──────────┬──────────┬──────────┬─────────────┬───────┐
|
|
33
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
34
|
-
├──────────┼──────────┼──────────┼──────────┼─────────────┼───────┤
|
|
35
|
-
│ 2.491574 │ 2.500577 │ 3.524734 │ 6.177946 │ 2681.101875 │ 1000 │
|
|
36
|
-
└──────────┴──────────┴──────────┴──────────┴─────────────┴───────┘
|
|
37
|
-
✓ Measure 1000 mongodb query inserts
|
|
38
|
-
┌──────────┬──────────┬──────────┬─────────┬─────────────┬───────┐
|
|
39
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
40
|
-
├──────────┼──────────┼──────────┼─────────┼─────────────┼───────┤
|
|
41
|
-
│ 3.946823 │ 3.921073 │ 5.969672 │ 6.26903 │ 3954.008642 │ 1000 │
|
|
42
|
-
└──────────┴──────────┴──────────┴─────────┴─────────────┴───────┘
|
|
43
|
-
✓ Measure 1000 postgres group data
|
|
44
|
-
┌──────────┬──────────┬──────────┬──────────┬────────────┬───────┐
|
|
45
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
46
|
-
├──────────┼──────────┼──────────┼──────────┼────────────┼───────┤
|
|
47
|
-
│ 0.287954 │ 0.272375 │ 0.347489 │ 0.494122 │ 279.076014 │ 1000 │
|
|
48
|
-
└──────────┴──────────┴──────────┴──────────┴────────────┴───────┘
|
|
49
|
-
✓ Measure 1000 mongodb group data
|
|
50
|
-
┌──────────┬──────────┬──────────┬──────────┬────────────┬───────┐
|
|
51
|
-
│ (index) │ med │ p95 │ p99 │ total │ count │
|
|
52
|
-
├──────────┼──────────┼──────────┼──────────┼────────────┼───────┤
|
|
53
|
-
│ 0.564809 │ 0.556707 │ 0.666702 │ 0.851308 │ 569.134585 │ 1000 │
|
|
54
|
-
└──────────┴──────────┴──────────┴──────────┴────────────┴───────┘
|
|
55
|
-
```
|
package/src/__tests__/runner.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Benchmark } from '../benchmark.js';
|
|
2
|
-
|
|
3
|
-
const benchmark = Benchmark.create('void')
|
|
4
|
-
.feed('strings', () => ['a', 'b', 'c'])
|
|
5
|
-
.feed('numbers', () => [0, 1, 2]);
|
|
6
|
-
|
|
7
|
-
const httpServer = benchmark.target('node http', async () => {
|
|
8
|
-
const { createServer, Server } = await import('node:http');
|
|
9
|
-
const server = createServer();
|
|
10
|
-
return new Promise<InstanceType<typeof Server>>((resolve) => {
|
|
11
|
-
server.on('listen', () => resolve(server));
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
httpServer.teardown((ctx) => {
|
|
16
|
-
ctx.close();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
httpServer
|
|
20
|
-
.measure('something to bench', async (ctx, input) => {
|
|
21
|
-
ctx.emit('whatever', input);
|
|
22
|
-
})
|
|
23
|
-
.pre(async (ctx, input) => {})
|
|
24
|
-
.post(async (ctx, input) => {});
|
|
25
|
-
|
|
26
|
-
const forLoop = benchmark.target('for loop');
|
|
27
|
-
|
|
28
|
-
forLoop
|
|
29
|
-
.measure('1k', (_, input) => {
|
|
30
|
-
const n = input?.length ?? 0;
|
|
31
|
-
for (let i = 0; i < n; i++) {}
|
|
32
|
-
})
|
|
33
|
-
.pre(async (ctx, input) => {})
|
|
34
|
-
.post(async (ctx, input) => {});
|