Skip to content

Instantly share code, notes, and snippets.

@stravant
Created August 15, 2021 20:55
Show Gist options
  • Save stravant/5c998b371911487f12744409b56c6460 to your computer and use it in GitHub Desktop.
Save stravant/5c998b371911487f12744409b56c6460 to your computer and use it in GitHub Desktop.
Benchmark for different types of signal
local ASignal = require(game:GetService("ServerStorage").ASignal)
local FSignal = require(game:GetService("ServerStorage").FSignal)
local function FireMany(sig)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Connect(function() end)
sig:Fire()
sig:Fire()
end
local function ConnectDisconnectMany(sig)
local c1 = sig:Connect(function() end)
local c2 = sig:Connect(function() end)
local c3 = sig:Connect(function() end)
local c4 = sig:Connect(function() end)
local c5 = sig:Connect(function() end)
local c6 = sig:Connect(function() end)
local c7 = sig:Connect(function() end)
local c8 = sig:Connect(function() end)
c1:Disconnect()
c2:Disconnect()
c3:Disconnect()
c4:Disconnect()
c5:Disconnect()
c6:Disconnect()
c7:Disconnect()
c8:Disconnect()
end
return {
ParameterGenerator = function()
end;
Functions = {
["Fire Many Array"] = function(Profiler, RandomNumber)
FireMany(ASignal.new())
end;
["Fire Many Dict"] = function(Profiler, RandomNumber)
FireMany(FSignal.new())
end;
["ConnectDisconnect Array"] = function(Profiler, RandomNumber)
FireMany(ASignal.new())
end;
["ConnectDisconnect Dict"] = function(Profiler, RandomNumber)
FireMany(FSignal.new())
end;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment