mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
feat: use alien-signals
This commit is contained in:
parent
d7a1f62c3c
commit
861ee5acd7
76 changed files with 3112 additions and 1862 deletions
44
tests/benchmarks/effect.bench.luau
Normal file
44
tests/benchmarks/effect.bench.luau
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Charm = require(ReplicatedStorage.DevPackages.Charm)
|
||||
|
||||
local computed = Charm.computed
|
||||
local effect = Charm.effect
|
||||
local atom = Charm.atom
|
||||
|
||||
local cleanup: () -> ()
|
||||
|
||||
return {
|
||||
AfterEach = function()
|
||||
cleanup()
|
||||
end,
|
||||
Functions = {
|
||||
atom = function()
|
||||
local state = atom(0)
|
||||
|
||||
cleanup = effect(function()
|
||||
state()
|
||||
end)
|
||||
|
||||
for _ = 1, 500 do
|
||||
state(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
|
||||
computed = function()
|
||||
local state = atom(0)
|
||||
|
||||
local double = computed(function()
|
||||
return 2 * state()
|
||||
end)
|
||||
|
||||
cleanup = effect(function()
|
||||
double()
|
||||
end)
|
||||
|
||||
for _ = 1, 500 do
|
||||
state(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue