flowchart TB
subgraph JSON["JSON Approach"]
direction TB
J1["Game State\n201 bytes"]
J2["JSON.stringify()\n0.03ms"]
J3["Network Transfer\n50ms"]
J4["JSON.parse()\n0.05ms"]
J5["Object Creation\nGarbage Collection"]
J1 --> J2
J2 --> J3
J3 --> J4
J4 --> J5
end
subgraph Binary["Binary Approach"]
direction TB
B1["Game State\n41 bytes"]
B2["Memory Copy\n0.01ms"]
B3["Network Transfer\n40ms"]
B4["Direct Memory Map\n0.01ms"]
B5["Zero Allocation\nNo GC"]
B1 --> B2
B2 --> B3
B3 --> B4
B4 --> B5
end
%% Comparisons
Comp1["80% Smaller"]
Comp2["75% Faster Processing"]
Comp3["20% Lower Latency"]
Comp4["95% Less Memory"]
J1 -.->|"Size"| Comp1
B1 -.->|"Size"| Comp1
J2 -.->|"Speed"| Comp2
B2 -.->|"Speed"| Comp2
J3 -.->|"Latency"| Comp3
B3 -.->|"Latency"| Comp3
J5 -.->|"Memory"| Comp4
B5 -.->|"Memory"| Comp4
classDef json fill:#f9f,stroke:#333,stroke-width:2px
classDef binary fill:#bbf,stroke:#333,stroke-width:2px
classDef comparison fill:#dfd,stroke:#333,stroke-width:2px
class JSON json
class Binary binary
class Comp1,Comp2,Comp3,Comp4 comparison
Created
November 11, 2024 20:11
-
-
Save nandordudas/249e364ac229177248bd474e1a84e186 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment