Bindable: An extremely lightweight & fast RBXScriptSignal implementation

There’s an issue, creating two or more connections to then disconnect at least one or more will force the connection insertion order to be no longer reliable. If this is intentional, you should note it in your Multi-Connections example pls

local Bindable = require(game:GetService("ServerStorage").Signals.Bindable)

local signal = Bindable.new()

local cn1 = signal:Connect(function() end)
local cn2 = signal:Connect(function() end)
cn1:Disconnect()
cn2:Disconnect()

signal:Once(function()
	print("1. Once")
end)
signal:Connect(function()
	print("2. Connect")
end)
task.spawn(function()
	signal:Wait()
	print("3. Wait")
end)

signal:Fire()

image

^ Although this is true for creating connections and firing one connection, it doesn’t apply to all categories. I recommend taking a look at SomeSignal’s or NamedSignal’s code if you would like to shatter the 1μs speed barrier for firing one and many connections that contain yields (Fire_OneYield & Fire_ManyYield)

Bindable-Module Results

SomeSignal Results

NamedSignal 1.2.0 (older version) Results

NamedSignal 2.3.2 (latest version) Results

Signal testing suite if you’re interested:

Aside from the ordering issue, I consider your module a solid option as a BindableEvent replacement :+1:

2 Likes