overtake 0.0.1-rc2 → 0.0.1-rc3
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/README.md +12 -8
- package/index.d.ts +82 -0
- package/index.js +0 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ benchmark('mongodb vs postgres', () => {
|
|
|
55
55
|
return { postgres, mongo };
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
measure('mongodb inserts', ({ mongo }/* context */, next) => {
|
|
58
|
+
measure('mongodb inserts', ({ mongo } /* context */, next) => {
|
|
59
59
|
// prepare a collection
|
|
60
60
|
const database = mongo.db('overtake');
|
|
61
61
|
const test = database.collection('test');
|
|
@@ -63,21 +63,19 @@ benchmark('mongodb vs postgres', () => {
|
|
|
63
63
|
return (data) => test.insertOne(data).then(next);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
measure('postgres inserts', ({ postgres }/* context */, next) => {
|
|
66
|
+
measure('postgres inserts', ({ postgres } /* context */, next) => {
|
|
67
67
|
// prepare a query
|
|
68
68
|
const query = 'INSERT INTO overtake(value) VALUES($1) RETURNING *';
|
|
69
69
|
|
|
70
70
|
return (data) => postgres.query(query, [data.value]).then(next);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
teardown(({ mongo, postgres }) => {
|
|
74
|
-
await postgres.end()
|
|
75
|
-
await mongo.end()
|
|
73
|
+
teardown(async ({ mongo, postgres }) => {
|
|
74
|
+
await postgres.end();
|
|
75
|
+
await mongo.end();
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
-
perform('simple test', 100000, [
|
|
79
|
-
{ value: 'test' },
|
|
80
|
-
]);
|
|
78
|
+
perform('simple test', 100000, [[{ value: 'test' }]]);
|
|
81
79
|
});
|
|
82
80
|
```
|
|
83
81
|
|
|
@@ -87,6 +85,12 @@ Make sure you have installed used modules and run
|
|
|
87
85
|
yarn overtake
|
|
88
86
|
```
|
|
89
87
|
|
|
88
|
+
or
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx overtake
|
|
92
|
+
```
|
|
93
|
+
|
|
90
94
|
Please take a look at [benchmarks](__benchmarks__) to see more examples
|
|
91
95
|
|
|
92
96
|
## License
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Event } from 'evnty';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
type CanBePromise<T> = Promise<T> | T;
|
|
5
|
+
|
|
6
|
+
interface Report {
|
|
7
|
+
type: string;
|
|
8
|
+
success: boolean;
|
|
9
|
+
count: number;
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
sum: number;
|
|
13
|
+
avg: number;
|
|
14
|
+
med: number;
|
|
15
|
+
mode: number;
|
|
16
|
+
p90: number;
|
|
17
|
+
p95: number;
|
|
18
|
+
p99: number;
|
|
19
|
+
setup: number;
|
|
20
|
+
init: number;
|
|
21
|
+
cycles: number;
|
|
22
|
+
teardown: number;
|
|
23
|
+
total: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Overtake {
|
|
27
|
+
onLoad: Event<any>;
|
|
28
|
+
|
|
29
|
+
onRun: Event<any>;
|
|
30
|
+
|
|
31
|
+
onComplete: Event<any>;
|
|
32
|
+
|
|
33
|
+
onScriptRegister: Event<any>;
|
|
34
|
+
|
|
35
|
+
onScriptStart: Event<any>;
|
|
36
|
+
|
|
37
|
+
onScriptComplete: Event<any>;
|
|
38
|
+
|
|
39
|
+
onSuiteRegister: Event<any>;
|
|
40
|
+
|
|
41
|
+
onSuiteStart: Event<any>;
|
|
42
|
+
|
|
43
|
+
onSuiteComplete: Event<any>;
|
|
44
|
+
|
|
45
|
+
onSetupRegister: Event<any>;
|
|
46
|
+
|
|
47
|
+
onTeardownRegister: Event<any>;
|
|
48
|
+
|
|
49
|
+
onMeasureRegister: Event<any>;
|
|
50
|
+
|
|
51
|
+
onMeasureStart: Event<any>;
|
|
52
|
+
|
|
53
|
+
onMeasureComplete: Event<any>;
|
|
54
|
+
|
|
55
|
+
onPerformRegister: Event<any>;
|
|
56
|
+
|
|
57
|
+
onPerformStart: Event<any>;
|
|
58
|
+
|
|
59
|
+
onPerformProgress: Event<any>;
|
|
60
|
+
|
|
61
|
+
onPerformComplete: Event<any>;
|
|
62
|
+
|
|
63
|
+
onReport: Event<Report>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function benchmark(title: string, init: () => void): void;
|
|
67
|
+
|
|
68
|
+
function setup<C>(init: () => CanBePromise<C>): any;
|
|
69
|
+
|
|
70
|
+
function teardown<C>(teardown: (context: C) => CanBePromise<void>): void;
|
|
71
|
+
|
|
72
|
+
type MeasureInitResult = CanBePromise<() => void>;
|
|
73
|
+
|
|
74
|
+
function measure(title: string, init: () => MeasureInitResult): void;
|
|
75
|
+
function measure(title: string, init: (next: () => void) => MeasureInitResult): void;
|
|
76
|
+
function measure<C>(title: string, init: (context: C, next: () => void) => MeasureInitResult): void;
|
|
77
|
+
function measure<C, A>(title: string, init: (context: C, args: A, next: () => void) => MeasureInitResult): void;
|
|
78
|
+
|
|
79
|
+
function perform<A>(title: string, counter: number, args: A): void;
|
|
80
|
+
|
|
81
|
+
function reporter(reporter: (overtake: Overtake) => void): void;
|
|
82
|
+
}
|
package/index.js
CHANGED