Skip to content

Commit 9e9ec30

Browse files
committed
working benchmark runner
1 parent 1c34923 commit 9e9ec30

File tree

12 files changed

+23563
-7274
lines changed

12 files changed

+23563
-7274
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ typings/
6060
# next.js build output
6161
.next
6262

63-
.idea
63+
.idea
64+
runs/

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,78 @@
11
# react-redux-benchmarks
22
Performance benchmark harness for React-Redux
3+
4+
# Running benchmarks
5+
```bash
6+
npm run initialize
7+
npm start
8+
```
9+
10+
After benchmarks have been initialized, you can run with simply:
11+
12+
```bash
13+
npm start
14+
```
15+
16+
## Running specific versions
17+
18+
To specify a single version:
19+
20+
```bash
21+
REDUX=5.0.7 npm start
22+
```
23+
24+
To specify running against multiple versions:
25+
26+
```bash
27+
REDUX=5.0.7:4.4.9 npm start
28+
```
29+
30+
To run a specific benchmark:
31+
32+
```bash
33+
BENCHMARKS=stockticker npm start
34+
```
35+
36+
or specific benchmarks:
37+
38+
```bash
39+
BENCHMARKS=stockticker:another npm start
40+
```
41+
42+
43+
# Adding a benchmark
44+
45+
Benchmarks live in the `sources/` directory. Each benchmark should copy the
46+
`config-overrides.js` and `"scripts"` section of the `stockticker`
47+
benchmark. In addition, this code must be inserted into `index.js`:
48+
49+
```js
50+
import {PerformanceMetadataMarker} from "performance-mark-metadata";
51+
import FpsEmitter from "fps-emitter";
52+
53+
const marker = new PerformanceMetadataMarker();
54+
window.marker = marker;
55+
56+
const fps = new FpsEmitter();
57+
fps.on("update", function(FPS) {
58+
// mark current FPS
59+
marker.mark("FPS", {
60+
details: { FPS }
61+
});
62+
});
63+
64+
const getFpsStats = () => {
65+
const logData = performance.getEntriesByType("mark").map(entry => {
66+
const meta = marker.getEntryMetadata(entry);
67+
return {
68+
type: entry.name,
69+
timeStamp: entry.startTime,
70+
meta: meta
71+
};
72+
});
73+
74+
return logData;
75+
}
76+
77+
window.getFpsStats = getFpsStats;
78+
```

0 commit comments

Comments
 (0)