Skip to content

Update all deps, add additional unit tests, add signals-polyfill, signia, svelte v5, update results #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5062250
Add tc39 stage 0 proposal
NullVoxPopuli Apr 2, 2024
3176a26
Update name/impl
NullVoxPopuli Apr 2, 2024
36c7b9a
feat: add prettier
transitive-bullshit Sep 13, 2024
8267754
feat: update reactivity lib deps
transitive-bullshit Sep 13, 2024
beb49a0
feat: add more unit tests and fix several bugs
transitive-bullshit Sep 13, 2024
fb86baa
feat: add comments explaining removed tests
transitive-bullshit Sep 13, 2024
2db02d8
feat: add signia framework
transitive-bullshit Sep 13, 2024
c8b55cb
docs: update results in readme
transitive-bullshit Sep 13, 2024
d85303f
docs: update results in readme
transitive-bullshit Sep 13, 2024
5ca140c
docs: update results in readme
transitive-bullshit Sep 13, 2024
74d62c8
docs: update results in readme
transitive-bullshit Sep 13, 2024
6ccdeef
docs: update results in readme
transitive-bullshit Sep 13, 2024
1daae2a
docs: update results in readme
transitive-bullshit Sep 13, 2024
e7b3872
docs: update results in readme
transitive-bullshit Sep 13, 2024
165cac8
docs: update results in readme
transitive-bullshit Sep 13, 2024
f898c3a
docs: update results in readme
transitive-bullshit Sep 13, 2024
c931f71
chore: remove extra debug logs
transitive-bullshit Sep 13, 2024
c5ff95a
feat: add valtio framework
transitive-bullshit Sep 15, 2024
9197a2f
feat: remove v8 native code to further simplify repro cases
transitive-bullshit Sep 15, 2024
0f0855c
feat: replace v8 intrinsics with node --expose-gc; replace pseudorand…
transitive-bullshit Sep 16, 2024
d8215fb
💌
transitive-bullshit Sep 16, 2024
abcdae3
🏎
transitive-bullshit Sep 16, 2024
3ed3e4f
feat: update tests to get them all working reliably
transitive-bullshit Sep 16, 2024
e9eb9c7
feat: fix @vue/reactivity for kairo tests
transitive-bullshit Sep 16, 2024
9c65fd2
👶
transitive-bullshit Sep 16, 2024
c22196a
🎒
transitive-bullshit Sep 16, 2024
29d22d6
docs: update benchmark results
transitive-bullshit Sep 16, 2024
ff8b962
🐶
transitive-bullshit Sep 16, 2024
902b720
transitive-bullshit Sep 16, 2024
0e93a8b
feat: update @vue/reactivity to latest fix
transitive-bullshit Sep 16, 2024
0adc71c
feat: remove warnings for vue issue
transitive-bullshit Sep 16, 2024
fd6d671
🐛
transitive-bullshit Sep 16, 2024
a136d20
feat: re-siable the cellx test suite for mobx
transitive-bullshit Sep 16, 2024
e83c0be
🚅
transitive-bullshit Sep 16, 2024
c501ada
feat: add svelte v5 framework to benchmark
transitive-bullshit Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": false,
"jsxSingleQuote": false,
"semi": true,
"useTabs": false,
"tabWidth": 2,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"trailingComma": "es5"
}
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,42 @@ $ pnpm bench

## Features

- Configurable dependency graph: graph shape, density, read rate are all adjustable.
- Configurable dependency graph: graph shape, density, read rate are all adjustable
- Easily add new benchmarks and frameworks
- Supports dynamic reactive nodes
- Framework agnostic. Simple API to test new reactive frameworks.
- Uses v8 intrinsics to warmup and cleanup
- Tracks garbage collection overhead per test
- Outputs a csv file for easy integration with other tools.

- Framework agnostic. Simple API to test new reactive frameworks
- Forces garbage collection between each test
- Outputs a csv file for easy integration with other tools

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.

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

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.

That said, there's learning here to improve performance of all the frameworks.

![Performance Results](https://user-images.githubusercontent.com/14153763/221107379-51a93eab-95ac-4c89-9a74-7a1527fc4a03.png)

![Raw](https://user-images.githubusercontent.com/14153763/222212050-5b651e4d-6e71-4667-94e7-eb94b7030bc1.png)
## Frameworks

- [Angular Signals](https://angular.dev/guide/signals/)
- [Compostate](https://github.com/lxsmnsyc/compostate)
- [Kairo](https://github.com/3Shain/kairo)
- [MobX](https://mobx.js.org)
- [mol wire](https://www.npmjs.com/package/mol_wire_lib)
- [Oby](https://github.com/vobyjs/oby)
- [Preact Signals](https://github.com/preactjs/signals)
- [Reactively](https://github.com/milomg/reactively)
- [S.js](https://github.com/adamhaile/S)
- [Signia](https://github.com/tldraw/signia)
- [Solid](https://github.com/solidjs/solid)
- [Svelte v5](https://svelte.dev/blog/runes)
- [TC39 Signals Proposal](https://github.com/tc39/proposal-signals) [polyfill](https://github.com/proposal-signals/signal-polyfill)
- [uSignal](https://github.com/WebReflection/usignal)
- [Valtio](https://github.com/pmndrs/valtio)
- [Vue Reactivity](https://vuejs.org/guide/essentials/reactivity-fundamentals.html)
- [x-reactivity](https://www.npmjs.com/package/@solidjs/reactivity)

## Results

<p align='center'>
<img src="https://github.com/user-attachments/assets/f6d041a1-d5da-4b30-8e60-b4c815ac70bc" alt="Average benchmark results across frameworks">
(<em>lower times are better</em>)
</p>

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)).
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,40 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "vitest",
"bench": "esbuild src/index.ts --external:v8-natives --bundle --format=cjs --platform=node | node --allow-natives-syntax"
"test": "vitest run",
"build": "esbuild src/index.ts --bundle --format=cjs --platform=node --outdir=dist --sourcemap=external",
"run": "node --expose-gc dist/index.js",
"bench": "esbuild src/index.ts --bundle --format=cjs --platform=node | node --expose-gc"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@angular/core": "17.0.0-rc.1",
"@preact/signals": "^1.2.1",
"@angular/core": "18.2.4",
"@preact/signals": "^1.3.0",
"@reactively/core": "^0.0.8",
"@solidjs/reactivity": "^0.0.9",
"@vue/reactivity": "^3.3.4",
"compostate": "^0.5.1",
"@vue/reactivity": "^3.5.6",
"compostate": "0.5.1",
"kairo": "0.6.0-rc.0",
"mobx": "^6.10.0",
"mol_wire_lib": "^1.0.707",
"oby": "14.3.1",
"preact": "^10.17.1",
"mobx": "^6.13.2",
"mol_wire_lib": "^1.0.1158",
"oby": "15.1.2",
"preact": "^10.24.0",
"random": "^5.1.0",
"react": "^18.3.1",
"s-js": "^0.4.9",
"solid-js": "^1.7.11",
"usignal": "^0.9.0"
"signal-polyfill": "^0.1.0",
"signia": "^0.1.5",
"solid-js": "^1.8.22",
"svelte": "5.0.0-next.246",
"usignal": "^0.9.0",
"valtio": "^2.0.0"
},
"devDependencies": {
"@types/node": "^20.5.1",
"esbuild": "^0.19.2",
"rxjs": "^7.8.1",
"v8-natives": "^1.2.5",
"vitest": "^0.34.2"
},
"pnpm": {
"patchedDependencies": {
"@angular/[email protected]": "patches/@[email protected]"
}
"@types/node": "^22.5.5",
"esbuild": "^0.23.1",
"prettier": "^3.3.3",
"vitest": "^2.1.1"
}
}
26 changes: 0 additions & 26 deletions patches/@[email protected]

This file was deleted.

Loading