although it uses more memory than the rest of the signals
Hello Devs!
I would like to introduce you to SignalX, my new signal system implementation designed specifically for maximum performance in Roblox. I’ve working on optimizing this module for a long time(4 days lol), and Im get very good resuls, so I want to share them with you.
What is SignalX
SignalX is a high–performance replacement for standard Roblox signals, designed for use in performance-critical systems. It uses
- Direct memory access: Minimal overhead due to the use of buffers to store connection information.
- Bit operations: Efficient memory usage and fast flag operations.
-
Thread Pool: Reused streams to minimize delays in triggering signals.
(This is what makes my code more memory-demanding, but in my opinion, speed is important for productive systems, not “oh no, it took an extra 10 megabytes on the server.”)
What is it for?
- Games with intensive input processing (for example, first-person shooters).
- Any systems where every millisecond counts.
Benchmarks! (The most interesting part)
I ran a series of tests comparing SignalX with others signals:
-
1000 Creations
And the SignalPlus is very good here!
here my module is as bad as possible due to the use of buffers. Alas, I can’t improve it in any way. -
1000 Fires no connections
-
1000 Connections no fires
caveat: sometimes performance in the benchmark can slip, I’m not sure why this is, but it doesn’t seem to happen in the game itself. -
1000 Connections + Disconnections
-
10 Fires 1 Connect
to be fair, I’ll make this benchmark again when we get the new version of SignalPlus. Maybe I’m doing something wrong.
as for poolThread, it’s just one thread that sits in your memory. In my opinion, this is a much better implementation than those that were in GoodSignal, and so on.
How To use?
Download: https://create.roblox.com/store/asset/127353288593114/SignalX
local Signal = require(path)
local mySignal = Signal.new()
-- alternatively, you can specify the power of two with the first argument, which should be > than the
-- number of signals you have. This minimizes buffer expansion inside the code. If you specify the
-- second argument, I do not recommend specifying more than 8 or 16
local connection = mySignal:Connect(function(...)
print(...)
end)
mySignal:Fire("Hello from signal") -- prints "Hello from signal"
connection:Disconnect()
Important! Limitations:
- there is literally nothing but Fire and Connect, because I created the module only recently.
- The module is under active development, and API changes are possible.
The future of SignalX:
I plan to continue working on SignalX, adding new features and optimizations. I will be glad to hear your feedback and suggestions!
If you have any questions, feel free to ask them in this thread. I’ll try to answer everything.
Thanks for your attention!
Donate if u think it cool
By Proxiom