Skip to content

Commit c47d608

Browse files
committed
chore: update benchmarks
1 parent 613f4b4 commit c47d608

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

packages/benchmarks/effect.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as mobx from 'mobx'
99
import * as valtio from 'valtio'
1010
import * as svelteStore from 'svelte/store'
1111
import * as jotai from 'jotai'
12+
import * as reatom from '@reatom/core'
1213
import * as agera from '../agera/dist/index.js' // 'agera'
1314

1415
const bench = new Bench({
@@ -172,6 +173,32 @@ bench
172173
unsub()
173174
assert.equal(logs.length, 3)
174175
})
176+
.add('@reatom/core / effect', () => {
177+
const a = reatom.atom(0)
178+
const logs = []
179+
const unsub = reatom.effect(() => {
180+
logs.push(a())
181+
})
182+
183+
a.set(a() + 1)
184+
a.set(a() + 1)
185+
186+
unsub()
187+
assert.equal(logs.length, 2)
188+
})
189+
.add('@reatom/core / effect (update fn)', () => {
190+
const a = reatom.atom(0)
191+
const logs = []
192+
const unsub = reatom.effect(() => {
193+
logs.push(a())
194+
})
195+
196+
a.set(v => v + 1)
197+
a.set(v => v + 1)
198+
199+
unsub()
200+
assert.equal(logs.length, 2)
201+
})
175202

176203
await bench.run()
177204

packages/benchmarks/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"node": ">=16"
2424
},
2525
"dependencies": {
26+
"@reatom/core": "^1000.15.1",
2627
"alien-signals-1": "npm:alien-signals@1.0.4",
2728
"alien-signals-3": "npm:alien-signals@3.1.2",
2829
"effector": "^23.4.4",

0 commit comments

Comments
 (0)