chore: delete redundant benchmarks

This commit is contained in:
littensy 2025-05-06 16:27:50 -07:00
parent ada1b80b87
commit f704acce71
2 changed files with 0 additions and 162 deletions

View file

@ -1,99 +0,0 @@
--!optimize 2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Charm = require(ReplicatedStorage.Packages.Charm)
local atom = Charm.atom
local computed = Charm.computed
local mapped = Charm.mapped
local pauseTracking = Charm.signals.pauseTracking
local resumeTracking = Charm.signals.resumeTracking
type Entry = { number }
local count = 512
local initialState: { Entry } = table.create(count)
for i = 1, count do
initialState[i] = table.create(32, i)
end
local function mapper(value: Entry): Entry
return table.clone(value)
end
local function simpleMapped(source: () -> { Entry }): () -> { Entry }
return computed(function()
local state = source()
local nextState = {}
for index, value in state do
pauseTracking()
local success, valueOut = pcall(mapper, value)
resumeTracking()
if success then
nextState[index] = valueOut
end
end
return state
end)
end
local function updatePercentage(percent: number): ({ Entry }) -> { Entry }
return function(state)
local nextState = table.clone(state)
for index, value in state do
if math.random() < percent then
nextState[index] = table.clone(value)
end
end
return nextState
end
end
local function test(
percent: number,
profiler: any,
mapped: (src: () -> { Entry }, ...(Entry) -> Entry) -> () -> { Entry }
)
local src = atom(initialState)
local out = mapped(src, mapper)
profiler.Begin("init")
out()
profiler.End()
profiler.Begin("setup")
src(updatePercentage(percent))
profiler.End()
profiler.Begin("update")
out()
profiler.End()
end
return {
Functions = {
["mapped 10%"] = function(profiler)
test(0.1, profiler, mapped)
end,
["mapped 50%"] = function(profiler)
test(0.5, profiler, mapped)
end,
["mapped 100%"] = function(profiler)
test(1, profiler, mapped)
end,
["control 10%"] = function(profiler)
test(0.1, profiler, simpleMapped)
end,
["control 50%"] = function(profiler)
test(0.5, profiler, simpleMapped)
end,
["control 100%"] = function(profiler)
test(1, profiler, simpleMapped)
end,
},
}

View file

@ -1,63 +0,0 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Charm = require(ReplicatedStorage.Packages.Charm)
local atom = Charm.atom
local computed = Charm.computed
local effect = Charm.effect
local listen = Charm.listen
local function propagate(w: number, h: number)
local src = atom(1)
for _ = 1, w do
local last = src
for _ = 1, h do
local prev = last
last = computed(function()
return prev() + 1
end)
end
effect(function()
last()
end)
end
src(src() + 1)
end
local function propagateListen(w: number, h: number)
local src = atom(1)
for _ = 1, w do
local last = src
for _ = 1, h do
local prev = last
last = computed(function()
return prev() + 1
end)
end
listen(last, function() end)
end
src(src() + 1)
end
return {
Functions = {
["effect 1*100"] = function()
propagate(1, 100)
end,
["effect 100*1"] = function()
propagate(100, 1)
end,
["effect 10*10"] = function()
propagate(10, 10)
end,
["listen 1*100"] = function()
propagateListen(1, 100)
end,
["listen 100*1"] = function()
propagateListen(100, 1)
end,
["listen 10*10"] = function()
propagateListen(10, 10)
end,
},
}