VoidSentry
High-performance buffer serialization for Roblox
Purpose
VoidSentry is a powerful, low-level buffer serializer designed for efficient data transmission in Roblox games. It provides both static (schema-based) and dynamic (schemaless) serialization with support for a wide range of data types.
๐ High Performance
Native optimizations and efficient buffer operations for maximum speed
๐ฆ Zero Dependencies
Standalone library with no external requirements
๐ฏ Type Safe
Full strict-mode Luau type annotations for better IDE support
โก Flexible
30+ built-in types including primitives, Roblox types, and complex structures
Installation
Wally:
[dependencies]
VoidSentry = "elentium/voidsentry@0.0.7"
Direct(rbxm):
find the VoidSentry.rbxm in roblox-direct file in repo
Then run: wally install
Quick Start
Static Serializer (Recommended)
--!strict
local VoidSentry = require(ReplicatedStorage.Packages.VoidSentry)
local Types = VoidSentry.Types
-- Create a serializer with a fixed schema
local Serializer = VoidSentry.Static.new(
nil, -- No compression
Types.Int32,
Types.String,
Types.Struct({
Hello = Types.String,
World = Types.Int32,
})
)
-- Serialize data
local b = Serializer:serialize(nil, 42, "Hello, world!", {
Hello = "hi",
World = 999,
})
-- Deserialize data
local int, str, struct = Serializer:deserialize(nil, b)
Dynamic Serializer
local VoidSentry = require(ReplicatedStorage.Packages.VoidSentry)
local Dynamic = VoidSentry.Dynamic
-- No schema required!
local buffer = Dynamic.serialize(
nil, -- No compression
nil, -- No offset
42,
"Dynamic serialization",
Vector3.new(10, 20, 30),
true
)
-- Deserialize automatically
local int, str, vec, bool = Dynamic.deserialize(nil, nil, buffer)
Performance Benchmarks
* All benchmarks performed with 2000 iterations per test on standard Roblox hardware. Results show average time per operation.
Static Serializer Performance
| Test Case | Serialize (avg) | Deserialize (avg) | Total (avg) |
|---|---|---|---|
| Simple Types (Int32, String, Bool) | 0.000959 ms | 0.000443 ms | 0.001402 ms |
| Vector Types (Vector3, Vector3F24) | 0.001292 ms | 0.000431 ms | 0.001723 ms |
| Array Types (Array<Int32>) | 0.001149 ms | 0.000563 ms | 0.001712 ms |
| Struct Types (PlayerData) | 0.001086 ms | 0.000782 ms | 0.001868 ms |
| Complex Nested Types | 0.002128 ms | 0.001329 ms | 0.003457 ms |
| With Compression (Level 5) | 0.002118 ms | 0.001450 ms | 0.003568 ms |
Dynamic Serializer Performance
| Test Case | Serialize (avg) | Deserialize (avg) | Total (avg) |
|---|---|---|---|
| Simple Types (Int32, String, Bool) | 0.002071 ms | 0.003448 ms | 0.005519 ms |
| Vector Types (Vector3) | 0.001214 ms | 0.001489 ms | 0.002703 ms |
| Array Types (Mixed Array) | 0.012221 ms | 0.009558 ms | 0.021779 ms |
| Struct Types (PlayerData as Table) | 0.014557 ms | 0.012684 ms | 0.027241 ms |
| Complex Nested Types | 0.017743 ms | 0.019277 ms | 0.037020 ms |
| Mixed Types (Multiple Types) | 0.011130 ms | 0.013152 ms | 0.024282 ms |
| With Compression (Level 5) | 0.003054 ms | 0.004565 ms | 0.007619 ms |
Performance Comparison
4.59x
faster (Static vs Dynamic)
Simple types benchmark shows Static serializer is ~4.6x faster
Static Simple Types
0.001174 ms
average per operation
Serialize + Deserialize combined
Dynamic Simple Types
0.005392 ms
average per operation
Serialize + Deserialize combined
Overhead
0.004218 ms
additional time per operation
Dynamic adds type inference overhead
๐ก Key Insights
- Static serializer is significantly faster (4.59x) for simple types
- Dynamic serializer overhead increases dramatically with complex nested structures
- Compression adds overhead but can be beneficial for larger datasets
- Deserialization is generally faster than serialization for Static, but slower for Dynamic due to type inference
- Use Static serializer when schema is known for optimal performance