mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
* refactor!: create monorepo * chore: prepare release, set up workflows * refactor: rename `modules` to `src` * docs: add docs for all packages * refactor: rename root project file * chore: bump deps * build: rename `lint`, add `pack` script * revert: delete pack script This will not be useful for development.
32 lines
580 B
Text
32 lines
580 B
Text
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,
|
|
}
|