Skip to content

Instantly share code, notes, and snippets.

@howmanysmall
Created June 5, 2023 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howmanysmall/90f81e207dcc43992bb07e7ae1cf6979 to your computer and use it in GitHub Desktop.
Save howmanysmall/90f81e207dcc43992bb07e7ae1cf6979 to your computer and use it in GitHub Desktop.
react bench
local HttpService = game:GetService("HttpService")
local React = require(script.Parent.Parent.Packages.Roact)
local tree
local function Component()
local value, setValue = React.useState("")
React.useEffect(function()
local connection = ReplicatedStorage:GetAttributeChangedSignal("Value"):Connect(setValue)
return function()
connection:Disconnect()
end
end, {})
return React.createElement("StringValue", {
Value = value,
})
end
return {
iterations = 100000,
setup = function()
tree = React.mount(React.createElement(Component, {}), workspace)
end,
teardown = function()
React.unmount(tree)
end,
step = function(i)
ReplicatedStorage:SetAttribute(tostring(i))
end,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment