mirror of
https://github.com/littensy/charm.git
synced 2026-10-23 05:46:27 +00:00
refactor!: create monorepo
This commit is contained in:
parent
b038bf1f70
commit
0416717f6c
68 changed files with 488 additions and 416 deletions
32
tests/benchmarks/atom.bench.luau
Normal file
32
tests/benchmarks/atom.bench.luau
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Charm = require(ReplicatedStorage.DevPackages.Charm)
|
||||
local computed = Charm.computed
|
||||
local atom = Charm.atom
|
||||
|
||||
local function parameterGenerator()
|
||||
return atom(0)
|
||||
end
|
||||
|
||||
local benchmarks = {
|
||||
atom = function(_, state: any)
|
||||
for _ = 1, 500 do
|
||||
state(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
|
||||
computed = function(_, state: any)
|
||||
computed(function()
|
||||
return 2 * state()
|
||||
end)
|
||||
|
||||
for _ = 1, 500 do
|
||||
state(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
return {
|
||||
ParameterGenerator = parameterGenerator,
|
||||
Functions = benchmarks,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue