File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -104,25 +104,25 @@ The true test of any game server architecture is performance under load. Our cli
104104``` rust
105105// Performance comparison - traditional vs client-aware
106106
107- // Traditional approach: ~15ms average response time
107+ // Traditional approach
108108async fn traditional_chat_handler (event : ChatMessage ) {
109109 // Process message: 2ms
110110 process_message (& event ). await ;
111111
112- // Lookup connection: 8ms (hash map contention)
112+ // Lookup connection
113113 let connection = find_connection (event . player_id). await ? ;
114114
115115 // Send response: 5ms
116116 connection . send_response (& response ). await ;
117117}
118118
119- // Client-aware approach: ~3ms average response time
119+ // Client-aware approach
120120events . on_client_with_connection (" chat" , " message" ,
121121 | event : ChatMessage , client : ClientConnectionRef | async move {
122- // Process message: 2ms (same)
122+ // Process message
123123 process_message (& event ). await ;
124124
125- // Direct response: 1ms (no lookup needed)
125+ // Direct response
126126 client . respond_json (& response ). await ;
127127 }
128128);
@@ -338,7 +338,6 @@ sequenceDiagram
338338 EventSystem->>GORC: Trigger Object Updates
339339 GORC->>Client: Replicate State Changes
340340
341- Note over Client, GORC: Total latency: 3-5ms for acknowledgment
342341 Note over Handler, Database: Background processing continues
343342```
344343
You can’t perform that action at this time.
0 commit comments