Skip to content

Commit 2ea2357

Browse files
committed
ye
1 parent e7d98c1 commit 2ea2357

1 file changed

Lines changed: 77 additions & 72 deletions

File tree

README.md

Lines changed: 77 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ Disabled by default. Zero overhead when off. Enable via `Lync.configure({ stats
486486

487487
## Benchmarks
488488

489-
Run `rojo serve bench.project.json`, open in Studio with one local server + one client. The suite has 7 sections. Fill in the `` placeholders after running the bench on your hardware.
489+
Run `rojo serve bench.project.json`, open in Studio with one local server + one client.
490490

491491
See `bench/Run.server.luau` for full configuration and methodology.
492492

@@ -496,107 +496,107 @@ Exact byte count per codec write. Raw payload only — no batch framing overhead
496496

497497
| Codec | Input | Bytes |
498498
|:------|:------|------:|
499-
| `bool` | `true` | |
500-
| `int(0, 255)` | `42` | |
501-
| `int(0, 65535)` | `1000` | |
502-
| `int(0, 1000000)` | `500000` | |
503-
| `int(-128, 127)` | `-50` | |
504-
| `f16` | `42.5` | |
505-
| `f32` | `3.14` | |
506-
| `f64` | `π` | |
507-
| `nothing` | `nil` | |
508-
| `string` | `""` (empty) | |
509-
| `string` | 5 chars | |
510-
| `string` | 191 chars (max inline prefix) | |
511-
| `string` | 192 chars (varint prefix) | |
512-
| `string` | 1000 chars | |
513-
| `vec2` | lossless | |
514-
| `vec2(0, 100, 1)` | u8 quantized | |
515-
| `vec3` | lossless | |
516-
| `vec3(0, 100, 1)` | u8 quantized | |
517-
| `vec3(-1000, 1000, 0.1)` | u16 quantized | |
518-
| `cframe` | lossless | |
519-
| `cframe()` | smallest-three | |
520-
| `color3` | RGB | |
521-
| `ray` | origin + direction | |
522-
| entity struct | 6 fields + bool (lossless) | |
523-
| entity struct | quantized fields (compact) | |
524-
| bitfield | bool + uint packed | |
525-
| `array` × 100 entities | 100× struct(6× u8) | |
526-
| `array` × 1000 bools | bitpacked | |
499+
| `bool` | `true` | 1 |
500+
| `int(0, 255)` | `42` | 1 |
501+
| `int(0, 65535)` | `1000` | 2 |
502+
| `int(0, 1000000)` | `500000` | 4 |
503+
| `int(-128, 127)` | `-50` | 1 |
504+
| `f16` | `42.5` | 2 |
505+
| `f32` | `3.14` | 4 |
506+
| `f64` | `π` | 8 |
507+
| `nothing` | `nil` | 0 |
508+
| `string` | `""` (empty) | 1 |
509+
| `string` | 5 chars | 6 |
510+
| `string` | 191 chars (max inline prefix) | 192 |
511+
| `string` | 192 chars (varint prefix) | 194 |
512+
| `string` | 1000 chars | 1002 |
513+
| `vec2` | lossless | 8 |
514+
| `vec2(0, 100, 1)` | u8 quantized | 2 |
515+
| `vec3` | lossless | 12 |
516+
| `vec3(0, 100, 1)` | u8 quantized | 3 |
517+
| `vec3(-1000, 1000, 0.1)` | u16 quantized | 6 |
518+
| `cframe` | lossless | 24 |
519+
| `cframe()` | smallest-three | 16 |
520+
| `color3` | RGB | 3 |
521+
| `ray` | origin + direction | 24 |
522+
| entity struct | 6 fields + bool (lossless) | 34 |
523+
| entity struct | quantized fields (compact) | 13 |
524+
| bitfield | bool + uint packed | 2 |
525+
| `array` × 100 entities | 100× struct(6× u8) | 601 |
526+
| `array` × 1000 bools | bitpacked | 127 |
527527

528528
### Codec Throughput
529529

530530
Isolated CPU cost. No networking. Encode + decode measured independently. 100k iterations with warmup.
531531

532532
| Codec | Bytes | Encode | Decode | Round-trips/sec |
533533
|:------|------:|-------:|-------:|----------------:|
534-
| `bool` | | | | |
535-
| `int(0, 255)` | | | | |
536-
| `int(0, 65535)` | | | | |
537-
| `f16` | | | | |
538-
| `f32` | | | | |
539-
| `f64` | | | | |
540-
| `string` (empty) | | | | |
541-
| `string` (10 chars) | | | | |
542-
| `string` (100 chars) | | | | |
543-
| `string` (1000 chars) | | | | |
544-
| `vec2` | | | | |
545-
| `vec3` | | | | |
546-
| `vec3` (quantized) | | | | |
547-
| `cframe` (lossless) | | | | |
548-
| `cframe()` (compressed) | | | | |
549-
| `color3` | | | | |
550-
| `udim2` | | | | |
551-
| entity struct | | | | |
552-
| entity compact | | | | |
553-
| bitfield flags | | | | |
554-
| 100× entity array | | | | |
555-
| 1000× bool array | | | | |
534+
| `bool` | 1 | 44ns | 29ns | 13,862,127 |
535+
| `int(0, 255)` | 1 | 42ns | 28ns | 14,387,868 |
536+
| `int(0, 65535)` | 2 | 41ns | 28ns | 14,395,324 |
537+
| `f16` | 2 | 61ns | 42ns | 9,686,824 |
538+
| `f32` | 4 | 41ns | 25ns | 15,003,300 |
539+
| `f64` | 8 | 41ns | 26ns | 14,844,063 |
540+
| `string` (empty) | 1 | 30ns | 22ns | 19,240,019 |
541+
| `string` (10 chars) | 11 | 46ns | 60ns | 9,441,889 |
542+
| `string` (100 chars) | 101 | 48ns | 91ns | 7,166,506 |
543+
| `string` (1000 chars) | 1002 | 76ns | 238ns | 3,179,953 |
544+
| `vec2` | 8 | 75ns | 43ns | 8,417,720 |
545+
| `vec3` | 12 | 53ns | 27ns | 12,360,328 |
546+
| `vec3` (quantized) | 3 | 130ns | 85ns | 4,636,348 |
547+
| `cframe` (lossless) | 24 | 92ns | 144ns | 4,232,266 |
548+
| `cframe()` (compressed) | 16 | 123ns | 170ns | 3,413,621 |
549+
| `color3` | 3 | 125ns | 58ns | 5,482,756 |
550+
| `udim2` | 16 | 235ns | 112ns | 2,880,482 |
551+
| entity struct | 34 | 239ns | 395ns | 1,578,183 |
552+
| entity compact | 13 | 377ns | 490ns | 1,153,064 |
553+
| bitfield flags | 2 | 142ns | 332ns | 2,107,486 |
554+
| 100× entity array | 601 | 15.2µs | 34.1µs | 20,306 |
555+
| 1000× bool array | 127 | 4.3µs | 5.1µs | 106,806 |
556556

557557
### Delta Savings
558558

559559
Byte cost across three consecutive writes: initial (full), identical repeat (unchanged), and single-field mutation (changed).
560560

561561
| Codec | Full | Unchanged | Changed | Savings |
562562
|:------|-----:|----------:|--------:|--------:|
563-
| `deltaStruct` (entity) | | | | |
564-
| `deltaStruct` (compact) | | | | |
565-
| `deltaArray` (100× entity) | | | | |
566-
| `deltaArray` (1000× bool) | | | | |
567-
| `deltaMap` (string → u8) | | | | |
563+
| `deltaStruct` (entity) | 35B | 1B | 35B | 97% |
564+
| `deltaStruct` (compact) | 14B | 1B | 14B | 93% |
565+
| `deltaArray` (100× entity) | 602B | 1B | 1B | 100% |
566+
| `deltaArray` (1000× bool) | 128B | 1B | 1B | 99% |
567+
| `deltaMap` (string → u8) | 19B | 1B | 19B | 95% |
568568

569569
### Batch Framing
570570

571571
MSB single-item batches use a 1-byte header. Multi-item batches add a u16 count after the header.
572572

573573
| Scenario | Total bytes | Per-item overhead |
574574
|:---------|----------:|------------------:|
575-
| 1 × u8 (single-item) | | |
576-
| 10 × u8 (multi-item) | | |
575+
| 1 × u8 (single-item) | 2B | 1B |
576+
| 10 × u8 (multi-item) | 13B | 0.3B |
577577

578578
### Network Throughput
579579

580580
Live sends to one player. Measured over 8 seconds. FPS and Kbps at median and tail.
581581

582582
| Packet | Fires/frame | FPS median | FPS p1 | Kbps median | Kbps p95 | Kbps p99 |
583583
|:-------|:---:|----:|----:|-----:|-----:|-----:|
584-
| booleans | 1000 | | | | | |
585-
| entity struct | 1000 | | | | | |
586-
| entity compact | 1000 | | | | | |
587-
| 100× entities | 100 | | | | | |
588-
| 1000× bools | 100 | | | | | |
589-
| bitfield flags | 1000 | | | | | |
590-
| cframe lossless | 1000 | | | | | |
591-
| cframe compressed | 1000 | | | | | |
584+
| booleans | 1000 | 60 | 59.9 | 2.5 | 6.2 | 6.2 |
585+
| entity struct | 1000 | 60 | 59.9 | 2.3 | 2.4 | 2.4 |
586+
| entity compact | 1000 | 60 | 59.9 | 2.4 | 2.5 | 2.5 |
587+
| 100× entities | 100 | 60 | 59.9 | 2.3 | 3.1 | 3.1 |
588+
| 1000× bools | 100 | 60 | 59.9 | 2.3 | 2.3 | 2.3 |
589+
| bitfield flags | 1000 | 60 | 59.9 | 2.4 | 2.5 | 2.5 |
590+
| cframe lossless | 1000 | 60 | 59.9 | 2.5 | 2.5 | 2.5 |
591+
| cframe compressed | 1000 | 60 | 59.8 | 2.3 | 2.3 | 2.3 |
592592

593593
---
594594

595595
### Cross-Library Comparison
596596

597597
The tables below use the same data shapes and methodology as [Blink's published benchmarks](https://github.com/1Axen/blink/blob/main/benchmark/Benchmarks.md): 1,000 fires/frame, same data every frame, 10 seconds, Kbps scaled by 60/FPS.
598598

599-
Numbers for `blink`, `zap`, `bytenet`, and `roblox` are copied directly from [Blink v0.17.1 results](https://github.com/1Axen/blink/blob/main/benchmark/Benchmarks.md) (2025-04-30). Fill in Lync numbers by running Section 7 of `bench/Run.server.luau` on the same hardware.
599+
Numbers for `blink`, `zap`, `bytenet`, and `roblox` are copied directly from [Blink v0.17.1 results](https://github.com/1Axen/blink/blob/main/benchmark/Benchmarks.md) (2025-04-30).
600600

601601
> [!NOTE]
602602
> **Architectural differences that affect these numbers:**
@@ -616,42 +616,47 @@ Numbers for `blink`, `zap`, `bytenet`, and `roblox` are copied directly from [Bl
616616
| Tool | Median | P0 | P80 | P90 | P95 | P100 | Loss |
617617
|:-----|-------:|---:|----:|----:|----:|-----:|-----:|
618618
| roblox | 16.00 | 16.00 | 15.00 | 15.00 | 15.00 | 15.00 | 0% |
619+
| **lync** | **60.00** | **61.00** | **60.00** | **60.00** | **60.00** | **58.00** | **0%** |
619620
| blink | 42.00 | 45.00 | 42.00 | 42.00 | 42.00 | 42.00 | 0% |
620621
| zap | 39.00 | 40.00 | 38.00 | 38.00 | 38.00 | 38.00 | 0% |
621622
| bytenet | 32.00 | 34.00 | 32.00 | 32.00 | 32.00 | 31.00 | 0% |
622-
| **lync** | **** | **** | **** | **** | **** | **** | **** |
623623

624624
#### Entities — Kbps
625625

626626
| Tool | Median | P0 | P80 | P90 | P95 | P100 | Loss |
627627
|:-----|-------:|---:|----:|----:|----:|-----:|-----:|
628628
| roblox | 559,364 | 559,364 | 676,716 | 676,716 | 676,716 | 784,082 | 0% |
629+
| **lync** | **3.68** | **3.61** | **3.72** | **3.75** | **3.75** | **4.18** | **0%** |
629630
| blink | 41.81 | 26.30 | 42.40 | 42.48 | 42.48 | 42.62 | 0% |
630631
| zap | 41.71 | 25.46 | 42.19 | 42.32 | 42.32 | 42.93 | 0% |
631632
| bytenet | 41.64 | 22.84 | 42.36 | 42.82 | 42.82 | 43.24 | 0% |
632-
| **lync** | **** | **** | **** | **** | **** | **** | **** |
633633

634634
#### Booleans — FPS
635635

636636
| Tool | Median | P0 | P80 | P90 | P95 | P100 | Loss |
637637
|:-----|-------:|---:|----:|----:|----:|-----:|-----:|
638638
| roblox | 21.00 | 22.00 | 20.00 | 19.00 | 19.00 | 19.00 | 0% |
639+
| **lync** | **60.00** | **61.00** | **60.00** | **60.00** | **60.00** | **59.00** | **0%** |
639640
| blink | 97.00 | 98.00 | 97.00 | 96.00 | 96.00 | 96.00 | 0% |
640641
| zap | 52.00 | 53.00 | 51.00 | 51.00 | 51.00 | 49.00 | 0% |
641642
| bytenet | 35.00 | 37.00 | 35.00 | 35.00 | 35.00 | 34.00 | 0% |
642-
| **lync** | **** | **** | **** | **** | **** | **** | **** |
643643

644644
#### Booleans — Kbps
645645

646646
| Tool | Median | P0 | P80 | P90 | P95 | P100 | Loss |
647647
|:-----|-------:|---:|----:|----:|----:|-----:|-----:|
648648
| roblox | 353,107 | 196,827 | 690,748 | 842,240 | 842,240 | 1,124,176 | 0% |
649+
| **lync** | **2.49** | **2.44** | **2.50** | **2.52** | **2.52** | **2.54** | **0%** |
649650
| blink | 7.91 | 7.41 | 7.93 | 7.99 | 7.99 | 8.00 | 0% |
650651
| zap | 8.10 | 5.75 | 8.17 | 8.22 | 8.22 | 8.27 | 0% |
651652
| bytenet | 8.11 | 5.07 | 8.35 | 8.46 | 8.46 | 8.47 | 0% |
652-
| **lync** | **** | **** | **** | **** | **** | **** | **** |
653653

654-
> To fill in Lync numbers: run `bench/Run.server.luau` Section 7. Copy the percentile output into the `lync` rows.
654+
#### Wire Size Comparison
655+
656+
| Data | Lync | Other tools | Difference |
657+
|:-----|-----:|------------:|-----------:|
658+
| 100× entities | 601B | ~602B | -1B |
659+
| 1000× bools | 127B | ~1002B | -875B (87% smaller) |
655660

656661
## License
657662

0 commit comments

Comments
 (0)