Skip to content

Commit 63e7f37

Browse files
committed
ye
1 parent 8940763 commit 63e7f37

205 files changed

Lines changed: 17865 additions & 8933 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 88 additions & 135 deletions
Large diffs are not rendered by default.

bench/Harness.luau

Lines changed: 85 additions & 340 deletions
Large diffs are not rendered by default.

bench/Run.client.luau

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,50 @@
11
--!strict
22
--!optimize 2
3-
-- Client-side benchmark runner. Drains s2c, then drives c2s.
3+
-- Client: receive s2c, then drive c2s.
44

55
local ReplicatedStorage = game:GetService("ReplicatedStorage")
6+
local Workspace = game:GetService("Workspace")
67

7-
local LyncFolder = ReplicatedStorage:WaitForChild("Lync")
8-
local Harness = require(LyncFolder.bench.Harness)
9-
local Lync = require(LyncFolder)
10-
local Scenarios = require(LyncFolder.bench.Scenarios)
11-
12-
-- Constants --------------------------------------------------------------
8+
local Lync = require(ReplicatedStorage:WaitForChild("Lync"))
9+
local Harness = require(ReplicatedStorage.Lync.bench.Harness)
10+
local Scenarios = require(ReplicatedStorage.Lync.bench.Scenarios)
1311

1412
local bench = Scenarios.bench
1513

16-
local function noop(): () end
17-
18-
--[[
19-
Client must mirror the server's channelMaxSize. Server and client run
20-
as separate Lua VMs with independent module state, so configure() on
21-
the server doesn't propagate. Without this, the client's buffer caps
22-
at the 256KB default and the comparison test (1000 fires of 601B
23-
entity arrays = 601KB) overflows during c2s.
24-
]]
25-
Lync.configure({ channelMaxSize = bench.channelMaxSize })
26-
Lync.start()
27-
28-
-- Attach receivers so server -> client throughput isn't held back by
29-
-- serializing into uncollected channels.
30-
for _, packet in Scenarios.packets do
31-
packet:on(noop)
14+
-- Minimise render contention so frame budget reflects bench CPU only.
15+
if Workspace.CurrentCamera then
16+
Workspace.CurrentCamera.FieldOfView = 1
3217
end
3318

34-
-- Wait through s2c phase -------------------------------------------------
19+
Lync.configure({ channelMaxSize = bench.channelMaxSize, stats = true })
20+
Lync.start()
3521

3622
Scenarios.handshake.ServerCpuDone:wait()
3723
Scenarios.handshake.ClientReady:send(true)
3824
Scenarios.handshake.ServerSwap:wait()
3925

40-
-- c2s throughput ---------------------------------------------------------
41-
42-
Harness.header("Network Throughput (client -> server)")
26+
-- Blink-comparable c2s ---------------------------------------------------
4327

44-
Harness.section(string.format("%d fires/frame, %ds per case", bench.smallFires, bench.netDuration))
45-
for _, case in Scenarios.netCases do
46-
local packet, data = case.packet, case.data
47-
Harness.benchNetwork(case.label, case.fires, bench.netDuration, function()
48-
packet:send(data)
49-
end)
28+
Harness.header(string.format(
29+
"Cross-library reference (c2s, %d fires/frame, %ds)",
30+
bench.blinkFiresPerFrame, bench.blinkSeconds
31+
))
32+
for _, case in Scenarios.blinkCases do
33+
Harness.throughput(case.label, bench.blinkFiresPerFrame, bench.blinkSeconds, case.pool,
34+
function(data) case.packet:send(data) end)
35+
task.wait(2)
5036
end
51-
Harness.sectionEnd()
52-
53-
-- Cross-library comparison (client -> server) ----------------------------
5437

55-
Harness.header("Cross-Library Comparison (client -> server)")
38+
-- Extended c2s -----------------------------------------------------------
5639

57-
for _, case in Scenarios.compCases do
58-
Harness.section(
59-
string.format("%s, %d/frame, %ds", case.title, bench.compFires, bench.compDuration)
60-
)
61-
local packet, data = case.packet, case.data
62-
Harness.benchComparison(
63-
case.label,
64-
bench.compFires,
65-
bench.compDuration,
66-
bench.compFps,
67-
function()
68-
packet:send(data)
69-
end
70-
)
71-
Harness.sectionEnd()
40+
Harness.header(string.format(
41+
"Extended (c2s, %d fires/frame, %ds)",
42+
bench.extendedFiresPerFrame, bench.extendedSeconds
43+
))
44+
for _, case in Scenarios.extendedCases do
45+
Harness.throughput(case.label, bench.extendedFiresPerFrame, bench.extendedSeconds, case.pool,
46+
function(data) case.packet:send(data) end)
47+
task.wait(1)
7248
end
7349

7450
Scenarios.handshake.ClientDone:send(true)

0 commit comments

Comments
 (0)