fix: skip nested captures (#22)

* fix: skip nested captures

* test: update atom bench
This commit is contained in:
richard 2024-09-28 17:17:54 -07:00 • committed by GitHub
parent 69e5f78463
commit 7c323e5739
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 71 additions and 44 deletions

View file

@ -1,7 +1,7 @@
-- This file is for use by Benchmarker
-- https://boatbomber.itch.io/benchmarker
local Package = game:GetService("ReplicatedStorage").Packages.charm
local Package = game:GetService("ReplicatedStorage").DevPackages.Charm
local atom = require(Package.atom)
local computed = require(Package.computed)
@ -11,19 +11,19 @@ local function parameterGenerator()
end
local benchmarks = {
atom = function(_, source: any)
atom = function(_, state: any)
for _ = 1, 500 do
source(math.random(1, 2))
state(math.random(1, 2))
end
end,
computed = function(_, source: any)
computed = function(_, state: any)
computed(function()
return 2 * source()
return 2 * state()
end)
for _ = 1, 500 do
source(math.random(1, 2))
state(math.random(1, 2))
end
end,
}