Skip to content

Commit 434a77f

Browse files
Merge pull request #1 from transitive-bullshit/feature/update
2 parents d774a14 + c501ada commit 434a77f

39 files changed

+2041
-1423
lines changed

.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": false,
3+
"jsxSingleQuote": false,
4+
"semi": true,
5+
"useTabs": false,
6+
"tabWidth": 2,
7+
"bracketSpacing": true,
8+
"bracketSameLine": false,
9+
"arrowParens": "always",
10+
"trailingComma": "es5"
11+
}

README.md

+32-13
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,42 @@ $ pnpm bench
66

77
## Features
88

9-
- Configurable dependency graph: graph shape, density, read rate are all adjustable.
9+
- Configurable dependency graph: graph shape, density, read rate are all adjustable
1010
- Easily add new benchmarks and frameworks
1111
- Supports dynamic reactive nodes
12-
- Framework agnostic. Simple API to test new reactive frameworks.
13-
- Uses v8 intrinsics to warmup and cleanup
14-
- Tracks garbage collection overhead per test
15-
- Outputs a csv file for easy integration with other tools.
16-
12+
- Framework agnostic. Simple API to test new reactive frameworks
13+
- Forces garbage collection between each test
14+
- Outputs a csv file for easy integration with other tools
1715

1816
Current reactivity benchmarks ([S.js](https://github.com/adamhaile/S/blob/master/bench/bench.js), [CellX](https://github.com/Riim/cellx/blob/master/perf/perf.html)) are focused on creation time, and update time for a static graph. Additionally, existing benchmarks aren't very configurable, and don't test for dynamic dependencies. We've created a new benchmark that allows library authors to compare their frameworks against each other, and against the existing benchmarks, as well as against a new configurable benchmark with dynamically changing sources.
1917

2018
We're also working on enabling consistent logging and efficient tracking of GC time across all benchmarks.
2119

22-
The frameworks are all plenty fast for typical applications. The charts report the run time of the test in milliseconds on an M1 laptop, and are made using [Tableau](https://public.tableau.com/). Typical applications will do much more work than a framework benchmark, and at these speeds the frameworks are unlikely to bottleneck overall performance.
23-
24-
That said, there's learning here to improve performance of all the frameworks.
25-
26-
![Performance Results](https://user-images.githubusercontent.com/14153763/221107379-51a93eab-95ac-4c89-9a74-7a1527fc4a03.png)
27-
28-
![Raw](https://user-images.githubusercontent.com/14153763/222212050-5b651e4d-6e71-4667-94e7-eb94b7030bc1.png)
20+
## Frameworks
21+
22+
- [Angular Signals](https://angular.dev/guide/signals/)
23+
- [Compostate](https://github.com/lxsmnsyc/compostate)
24+
- [Kairo](https://github.com/3Shain/kairo)
25+
- [MobX](https://mobx.js.org)
26+
- [mol wire](https://www.npmjs.com/package/mol_wire_lib)
27+
- [Oby](https://github.com/vobyjs/oby)
28+
- [Preact Signals](https://github.com/preactjs/signals)
29+
- [Reactively](https://github.com/milomg/reactively)
30+
- [S.js](https://github.com/adamhaile/S)
31+
- [Signia](https://github.com/tldraw/signia)
32+
- [Solid](https://github.com/solidjs/solid)
33+
- [Svelte v5](https://svelte.dev/blog/runes)
34+
- [TC39 Signals Proposal](https://github.com/tc39/proposal-signals) [polyfill](https://github.com/proposal-signals/signal-polyfill)
35+
- [uSignal](https://github.com/WebReflection/usignal)
36+
- [Valtio](https://github.com/pmndrs/valtio)
37+
- [Vue Reactivity](https://vuejs.org/guide/essentials/reactivity-fundamentals.html)
38+
- [x-reactivity](https://www.npmjs.com/package/@solidjs/reactivity)
39+
40+
## Results
41+
42+
<p align='center'>
43+
<img src="https://github.com/user-attachments/assets/f6d041a1-d5da-4b30-8e60-b4c815ac70bc" alt="Average benchmark results across frameworks">
44+
(<em>lower times are better</em>)
45+
</p>
46+
47+
These results were last updated _September 2024_ on an M3 Macbook Pro using Node.js v22.4.1 ([29d22d6](https://github.com/transitive-bullshit/js-reactivity-benchmark/tree/29d22d64666b25aa8268ef8ff30afe8d51bb7937)).

package.json

+24-22
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,40 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "vitest",
8-
"bench": "esbuild src/index.ts --external:v8-natives --bundle --format=cjs --platform=node | node --allow-natives-syntax"
7+
"test": "vitest run",
8+
"build": "esbuild src/index.ts --bundle --format=cjs --platform=node --outdir=dist --sourcemap=external",
9+
"run": "node --expose-gc dist/index.js",
10+
"bench": "esbuild src/index.ts --bundle --format=cjs --platform=node | node --expose-gc"
911
},
1012
"keywords": [],
1113
"author": "",
1214
"license": "ISC",
1315
"dependencies": {
14-
"@angular/core": "17.0.0-rc.1",
15-
"@preact/signals": "^1.2.1",
16+
"@angular/core": "18.2.4",
17+
"@preact/signals": "^1.3.0",
1618
"@reactively/core": "^0.0.8",
1719
"@solidjs/reactivity": "^0.0.9",
18-
"@vue/reactivity": "^3.3.4",
19-
"compostate": "^0.5.1",
20+
"@vue/reactivity": "^3.5.6",
21+
"compostate": "0.5.1",
2022
"kairo": "0.6.0-rc.0",
21-
"mobx": "^6.10.0",
22-
"mol_wire_lib": "^1.0.707",
23-
"oby": "14.3.1",
24-
"preact": "^10.17.1",
23+
"mobx": "^6.13.2",
24+
"mol_wire_lib": "^1.0.1158",
25+
"oby": "15.1.2",
26+
"preact": "^10.24.0",
27+
"random": "^5.1.0",
28+
"react": "^18.3.1",
2529
"s-js": "^0.4.9",
26-
"solid-js": "^1.7.11",
27-
"usignal": "^0.9.0"
30+
"signal-polyfill": "^0.1.0",
31+
"signia": "^0.1.5",
32+
"solid-js": "^1.8.22",
33+
"svelte": "5.0.0-next.246",
34+
"usignal": "^0.9.0",
35+
"valtio": "^2.0.0"
2836
},
2937
"devDependencies": {
30-
"@types/node": "^20.5.1",
31-
"esbuild": "^0.19.2",
32-
"rxjs": "^7.8.1",
33-
"v8-natives": "^1.2.5",
34-
"vitest": "^0.34.2"
35-
},
36-
"pnpm": {
37-
"patchedDependencies": {
38-
"@angular/[email protected]": "patches/@[email protected]"
39-
}
38+
"@types/node": "^22.5.5",
39+
"esbuild": "^0.23.1",
40+
"prettier": "^3.3.3",
41+
"vitest": "^2.1.1"
4042
}
4143
}

patches/@[email protected]

-26
This file was deleted.

0 commit comments

Comments
 (0)