charm/tests/benchmarks/atom.bench.luau
2025-01-25 15:05:55 -08:00

30 lines
544 B
Text

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Charm = require(ReplicatedStorage.DevPackages.Charm)
local computed = Charm.computed
local atom = Charm.atom
return {
ParameterGenerator = function() end,
Functions = {
atom = function()
local state = atom(0)
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)
for _ = 1, 500 do
state(math.random(1, 2))
end
end,
},
}