Created
June 5, 2023 15:16
-
-
Save howmanysmall/90f81e207dcc43992bb07e7ae1cf6979 to your computer and use it in GitHub Desktop.
react bench
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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