perf: release startup decode buffers and profile parsing tradeoffs
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
{
|
||||
"scope": "Isolated gameplay-facts.json validation/typed decoding; includes JSON file read",
|
||||
"resources": "/srv/bob-data/horizon/.local/horizon-client/26.3",
|
||||
"repeats": 10,
|
||||
"load_averages_before_after": [
|
||||
[
|
||||
14.7451171875,
|
||||
8.8994140625,
|
||||
6.89599609375
|
||||
],
|
||||
[
|
||||
14.7451171875,
|
||||
8.8994140625,
|
||||
6.89599609375
|
||||
]
|
||||
],
|
||||
"binary_sha256": "c2be9140c792720499d70c5806b8def0472734264ad72486d01365447e0cc2d7",
|
||||
"metrics": {
|
||||
"validate": {
|
||||
"phase_ms": {
|
||||
"median": 117.417,
|
||||
"p25": 114.101,
|
||||
"p75": 158.855,
|
||||
"min": 109.199,
|
||||
"max": 173.408,
|
||||
"samples": [
|
||||
109.199,
|
||||
113.958,
|
||||
110.195,
|
||||
118.987,
|
||||
171.275,
|
||||
124.701,
|
||||
170.24,
|
||||
173.408,
|
||||
115.848,
|
||||
114.531
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 139.933,
|
||||
"p25": 133.863,
|
||||
"p75": 193.565,
|
||||
"min": 129.75,
|
||||
"max": 276.311,
|
||||
"samples": [
|
||||
276.311,
|
||||
135.448,
|
||||
129.75,
|
||||
138.452,
|
||||
195.127,
|
||||
141.413,
|
||||
188.88,
|
||||
199.802,
|
||||
133.335,
|
||||
132.094
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 138.849,
|
||||
"p25": 134.285,
|
||||
"p75": 168.881,
|
||||
"min": 129.089,
|
||||
"max": 190.82,
|
||||
"samples": [
|
||||
140.962,
|
||||
136.06,
|
||||
129.089,
|
||||
139.059,
|
||||
189.478,
|
||||
138.639,
|
||||
178.187,
|
||||
190.82,
|
||||
133.693,
|
||||
132.716
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 56654.0,
|
||||
"p25": 56642.0,
|
||||
"p75": 56704.0,
|
||||
"min": 56616,
|
||||
"max": 56724,
|
||||
"samples": [
|
||||
56620,
|
||||
56656,
|
||||
56640,
|
||||
56720,
|
||||
56616,
|
||||
56724,
|
||||
56652,
|
||||
56720,
|
||||
56648,
|
||||
56656
|
||||
]
|
||||
}
|
||||
},
|
||||
"typed": {
|
||||
"phase_ms": {
|
||||
"median": 115.873,
|
||||
"p25": 109.422,
|
||||
"p75": 129.67,
|
||||
"min": 100.872,
|
||||
"max": 183.923,
|
||||
"samples": [
|
||||
116.965,
|
||||
132.071,
|
||||
100.872,
|
||||
105.098,
|
||||
122.468,
|
||||
170.777,
|
||||
107.997,
|
||||
183.923,
|
||||
113.699,
|
||||
114.781
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 133.883,
|
||||
"p25": 126.939,
|
||||
"p75": 155.913,
|
||||
"min": 117.54,
|
||||
"max": 210.164,
|
||||
"samples": [
|
||||
135.04,
|
||||
159.38,
|
||||
117.54,
|
||||
122.391,
|
||||
145.512,
|
||||
189.132,
|
||||
125.846,
|
||||
210.164,
|
||||
130.217,
|
||||
132.727
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 134.375,
|
||||
"p25": 126.231,
|
||||
"p75": 154.675,
|
||||
"min": 118.132,
|
||||
"max": 204.242,
|
||||
"samples": [
|
||||
135.633,
|
||||
157.961,
|
||||
118.132,
|
||||
122.77,
|
||||
144.816,
|
||||
178.293,
|
||||
124.755,
|
||||
204.242,
|
||||
130.661,
|
||||
133.117
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 83974.0,
|
||||
"p25": 82744.0,
|
||||
"p75": 84490.0,
|
||||
"min": 82332,
|
||||
"max": 84596,
|
||||
"samples": [
|
||||
83596,
|
||||
84596,
|
||||
82332,
|
||||
82424,
|
||||
84288,
|
||||
82460,
|
||||
84532,
|
||||
83660,
|
||||
84364,
|
||||
84536
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
{
|
||||
"scope": "Assets + BlockFacts + Behaviours loader only; no full startup or first frame",
|
||||
"resources": "/srv/bob-data/horizon/.local/horizon-client/26.3",
|
||||
"repeats": 8,
|
||||
"ordering": [
|
||||
[
|
||||
"baseline",
|
||||
"a01d47f2",
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"cd61e11b",
|
||||
"cf837118",
|
||||
"a01d47f2",
|
||||
"baseline"
|
||||
],
|
||||
[
|
||||
"baseline",
|
||||
"a01d47f2",
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"cd61e11b",
|
||||
"cf837118",
|
||||
"a01d47f2",
|
||||
"baseline"
|
||||
],
|
||||
[
|
||||
"baseline",
|
||||
"a01d47f2",
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"cd61e11b",
|
||||
"cf837118",
|
||||
"a01d47f2",
|
||||
"baseline"
|
||||
],
|
||||
[
|
||||
"baseline",
|
||||
"a01d47f2",
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"cd61e11b",
|
||||
"cf837118",
|
||||
"a01d47f2",
|
||||
"baseline"
|
||||
]
|
||||
],
|
||||
"load_average_before": [
|
||||
10.57958984375,
|
||||
8.45947265625,
|
||||
6.8134765625
|
||||
],
|
||||
"load_average_after": [
|
||||
7.158203125,
|
||||
7.7998046875,
|
||||
6.66455078125
|
||||
],
|
||||
"executables": {
|
||||
"baseline": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-e422bd13",
|
||||
"mode": "baseline",
|
||||
"sha256": "bf61f2e6c92e001be3c3bc93cf8072cc6af6fd1d7bcfa7273045960948ec89e7"
|
||||
},
|
||||
"a01d47f2": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-a01d47f2",
|
||||
"mode": "shared",
|
||||
"sha256": "88be56f8dbd28d0b4abd6c672486ba758df96ba18f68da45b94db14231dd3eea"
|
||||
},
|
||||
"cf837118": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-cf837118",
|
||||
"mode": "deferred",
|
||||
"sha256": "f1b044cd9ac2f67c644fb40bd7ecbe38128ec739a8112d57fc36f05fe9036a52"
|
||||
},
|
||||
"cd61e11b": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-cd61e11b",
|
||||
"mode": "deferred",
|
||||
"sha256": "fb2d3725b09ee38f85b49901f7053a6fe339b980a2b2dac6930a8ded22c139e8"
|
||||
},
|
||||
"current": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-new",
|
||||
"mode": "deferred",
|
||||
"sha256": "84eb1baae8e138f52e300b0b44f1339fca38e70db6e06126e78db776ea3e5cd0"
|
||||
}
|
||||
},
|
||||
"metrics": {
|
||||
"baseline": {
|
||||
"phase_ms": {
|
||||
"median": 1277.781,
|
||||
"p25": 1271.23,
|
||||
"p75": 1296.157,
|
||||
"min": 1223.341,
|
||||
"max": 1338.745,
|
||||
"samples": [
|
||||
1265.934,
|
||||
1223.341,
|
||||
1274.931,
|
||||
1289.177,
|
||||
1338.745,
|
||||
1317.096,
|
||||
1272.995,
|
||||
1280.631
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 1711.802,
|
||||
"p25": 1695.745,
|
||||
"p75": 1754.276,
|
||||
"min": 1645.69,
|
||||
"max": 2887.078,
|
||||
"samples": [
|
||||
2887.078,
|
||||
1645.69,
|
||||
1690.413,
|
||||
1711.459,
|
||||
1761.859,
|
||||
1751.748,
|
||||
1697.522,
|
||||
1712.144
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 1769.996,
|
||||
"p25": 1748.925,
|
||||
"p75": 1807.254,
|
||||
"min": 1705.167,
|
||||
"max": 1950.463,
|
||||
"samples": [
|
||||
1950.463,
|
||||
1705.167,
|
||||
1749.023,
|
||||
1768.05,
|
||||
1804.543,
|
||||
1815.386,
|
||||
1771.942,
|
||||
1748.632
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 820180.0,
|
||||
"p25": 820030.0,
|
||||
"p75": 820502.0,
|
||||
"min": 819472,
|
||||
"max": 820884,
|
||||
"samples": [
|
||||
819472,
|
||||
820416,
|
||||
820060,
|
||||
820096,
|
||||
820264,
|
||||
820884,
|
||||
819940,
|
||||
820760
|
||||
]
|
||||
}
|
||||
},
|
||||
"a01d47f2": {
|
||||
"phase_ms": {
|
||||
"median": 430.783,
|
||||
"p25": 427.542,
|
||||
"p75": 451.763,
|
||||
"min": 423.035,
|
||||
"max": 550.345,
|
||||
"samples": [
|
||||
491.599,
|
||||
423.035,
|
||||
428.85,
|
||||
427.694,
|
||||
432.715,
|
||||
427.084,
|
||||
438.484,
|
||||
550.345
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 868.457,
|
||||
"p25": 863.709,
|
||||
"p75": 932.066,
|
||||
"min": 837.75,
|
||||
"max": 997.779,
|
||||
"samples": [
|
||||
911.935,
|
||||
837.75,
|
||||
865.419,
|
||||
868.626,
|
||||
858.578,
|
||||
997.779,
|
||||
868.288,
|
||||
992.46
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 897.639,
|
||||
"p25": 887.661,
|
||||
"p75": 944.363,
|
||||
"min": 865.497,
|
||||
"max": 1001.635,
|
||||
"samples": [
|
||||
925.321,
|
||||
865.497,
|
||||
899.505,
|
||||
895.774,
|
||||
876.929,
|
||||
1001.635,
|
||||
891.239,
|
||||
1001.488
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 351906.0,
|
||||
"p25": 351505.0,
|
||||
"p75": 352181.0,
|
||||
"min": 351176,
|
||||
"max": 352440,
|
||||
"samples": [
|
||||
352008,
|
||||
352120,
|
||||
351352,
|
||||
351556,
|
||||
351804,
|
||||
351176,
|
||||
352440,
|
||||
352364
|
||||
]
|
||||
}
|
||||
},
|
||||
"cf837118": {
|
||||
"phase_ms": {
|
||||
"median": 408.459,
|
||||
"p25": 398.987,
|
||||
"p75": 428.585,
|
||||
"min": 387.999,
|
||||
"max": 524.425,
|
||||
"samples": [
|
||||
433.521,
|
||||
387.999,
|
||||
412.195,
|
||||
397.366,
|
||||
404.724,
|
||||
399.527,
|
||||
426.939,
|
||||
524.425
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 851.294,
|
||||
"p25": 823.291,
|
||||
"p75": 890.55,
|
||||
"min": 801.356,
|
||||
"max": 1030.737,
|
||||
"samples": [
|
||||
892.054,
|
||||
801.356,
|
||||
840.381,
|
||||
818.285,
|
||||
862.208,
|
||||
824.96,
|
||||
890.049,
|
||||
1030.737
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 870.765,
|
||||
"p25": 850.849,
|
||||
"p75": 907.922,
|
||||
"min": 825.718,
|
||||
"max": 1041.996,
|
||||
"samples": [
|
||||
906.657,
|
||||
825.718,
|
||||
866.472,
|
||||
843.591,
|
||||
875.058,
|
||||
853.268,
|
||||
911.715,
|
||||
1041.996
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 274172.0,
|
||||
"p25": 273909.0,
|
||||
"p75": 274438.0,
|
||||
"min": 273668,
|
||||
"max": 274964,
|
||||
"samples": [
|
||||
274372,
|
||||
274964,
|
||||
273668,
|
||||
273972,
|
||||
274552,
|
||||
274400,
|
||||
273840,
|
||||
273932
|
||||
]
|
||||
}
|
||||
},
|
||||
"cd61e11b": {
|
||||
"phase_ms": {
|
||||
"median": 419.114,
|
||||
"p25": 404.191,
|
||||
"p75": 460.634,
|
||||
"min": 388.557,
|
||||
"max": 735.687,
|
||||
"samples": [
|
||||
457.971,
|
||||
418.303,
|
||||
388.557,
|
||||
405.041,
|
||||
419.925,
|
||||
401.64,
|
||||
468.624,
|
||||
735.687
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 840.723,
|
||||
"p25": 835.398,
|
||||
"p75": 917.995,
|
||||
"min": 811.43,
|
||||
"max": 1565.471,
|
||||
"samples": [
|
||||
906.328,
|
||||
837.706,
|
||||
811.43,
|
||||
835.727,
|
||||
843.74,
|
||||
834.412,
|
||||
952.996,
|
||||
1565.471
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 863.404,
|
||||
"p25": 858.916,
|
||||
"p75": 934.2,
|
||||
"min": 833.955,
|
||||
"max": 1550.132,
|
||||
"samples": [
|
||||
916.017,
|
||||
864.82,
|
||||
833.955,
|
||||
859.057,
|
||||
861.989,
|
||||
858.494,
|
||||
988.748,
|
||||
1550.132
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 267508.0,
|
||||
"p25": 267310.0,
|
||||
"p75": 267890.0,
|
||||
"min": 267172,
|
||||
"max": 268412,
|
||||
"samples": [
|
||||
267304,
|
||||
268292,
|
||||
267312,
|
||||
267756,
|
||||
267340,
|
||||
267676,
|
||||
267172,
|
||||
268412
|
||||
]
|
||||
}
|
||||
},
|
||||
"current": {
|
||||
"phase_ms": {
|
||||
"median": 406.779,
|
||||
"p25": 397.839,
|
||||
"p75": 413.957,
|
||||
"min": 385.028,
|
||||
"max": 552.051,
|
||||
"samples": [
|
||||
387.136,
|
||||
385.028,
|
||||
409.317,
|
||||
404.242,
|
||||
401.407,
|
||||
411.451,
|
||||
421.476,
|
||||
552.051
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 819.787,
|
||||
"p25": 814.211,
|
||||
"p75": 855.69,
|
||||
"min": 800.867,
|
||||
"max": 1128.453,
|
||||
"samples": [
|
||||
808.685,
|
||||
800.867,
|
||||
816.053,
|
||||
817.907,
|
||||
821.667,
|
||||
843.26,
|
||||
892.982,
|
||||
1128.453
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 847.078,
|
||||
"p25": 836.598,
|
||||
"p75": 877.524,
|
||||
"min": 826.002,
|
||||
"max": 1134.369,
|
||||
"samples": [
|
||||
834.665,
|
||||
826.002,
|
||||
837.243,
|
||||
842.86,
|
||||
851.296,
|
||||
864.892,
|
||||
915.419,
|
||||
1134.369
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 267956.0,
|
||||
"p25": 267612.0,
|
||||
"p75": 268326.0,
|
||||
"min": 267308,
|
||||
"max": 268428,
|
||||
"samples": [
|
||||
268428,
|
||||
267308,
|
||||
268260,
|
||||
267516,
|
||||
267652,
|
||||
268312,
|
||||
268368,
|
||||
267644
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"experiment_note": "Experimental projection variant (reused sounds, Arc-keyed string pools and direct flags); reverted after mixed CPU/RSS evidence. Current in this file is not the final PR version."
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
{
|
||||
"scope": "Assets + BlockFacts + Behaviours loader only; no full startup or first frame",
|
||||
"resources": "/srv/bob-data/horizon/.local/horizon-client/26.3",
|
||||
"repeats": 8,
|
||||
"ordering": [
|
||||
[
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"arc-key",
|
||||
"reused-sounds",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"reused-sounds",
|
||||
"arc-key",
|
||||
"cd61e11b",
|
||||
"cf837118"
|
||||
],
|
||||
[
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"arc-key",
|
||||
"reused-sounds",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"reused-sounds",
|
||||
"arc-key",
|
||||
"cd61e11b",
|
||||
"cf837118"
|
||||
],
|
||||
[
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"arc-key",
|
||||
"reused-sounds",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"reused-sounds",
|
||||
"arc-key",
|
||||
"cd61e11b",
|
||||
"cf837118"
|
||||
],
|
||||
[
|
||||
"cf837118",
|
||||
"cd61e11b",
|
||||
"arc-key",
|
||||
"reused-sounds",
|
||||
"current"
|
||||
],
|
||||
[
|
||||
"current",
|
||||
"reused-sounds",
|
||||
"arc-key",
|
||||
"cd61e11b",
|
||||
"cf837118"
|
||||
]
|
||||
],
|
||||
"load_average_before": [
|
||||
10.9873046875,
|
||||
8.37646484375,
|
||||
6.91015625
|
||||
],
|
||||
"load_average_after": [
|
||||
8.6962890625,
|
||||
8.1591796875,
|
||||
6.90087890625
|
||||
],
|
||||
"executables": {
|
||||
"cf837118": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-cf837118",
|
||||
"mode": "deferred",
|
||||
"sha256": "f1b044cd9ac2f67c644fb40bd7ecbe38128ec739a8112d57fc36f05fe9036a52"
|
||||
},
|
||||
"cd61e11b": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-cd61e11b",
|
||||
"mode": "deferred",
|
||||
"sha256": "fb2d3725b09ee38f85b49901f7053a6fe339b980a2b2dac6930a8ded22c139e8"
|
||||
},
|
||||
"arc-key": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-arcpool",
|
||||
"mode": "deferred",
|
||||
"sha256": "8cbb53d01afedf5c7a5da0e36c9f8c3569f34def9bc51488fe8699e7f615a131"
|
||||
},
|
||||
"reused-sounds": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-reusesounds",
|
||||
"mode": "deferred",
|
||||
"sha256": "f45794bfbdbb3f9b5d34c375d397191ac67984b3ae91268aa3fdd02f2c1b7b98"
|
||||
},
|
||||
"current": {
|
||||
"path": "/srv/bob-data/horizon/.worktrees/shared-block-json-20261017/target/release/examples/shared_json_startup_profile-new",
|
||||
"mode": "deferred",
|
||||
"sha256": "84eb1baae8e138f52e300b0b44f1339fca38e70db6e06126e78db776ea3e5cd0"
|
||||
}
|
||||
},
|
||||
"metrics": {
|
||||
"cf837118": {
|
||||
"phase_ms": {
|
||||
"median": 424.082,
|
||||
"p25": 417.508,
|
||||
"p75": 430.923,
|
||||
"min": 395.439,
|
||||
"max": 948.609,
|
||||
"samples": [
|
||||
948.609,
|
||||
425.085,
|
||||
425.571,
|
||||
417.945,
|
||||
395.439,
|
||||
416.197,
|
||||
423.078,
|
||||
446.98
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 853.026,
|
||||
"p25": 839.421,
|
||||
"p75": 867.731,
|
||||
"min": 813.144,
|
||||
"max": 1906.081,
|
||||
"samples": [
|
||||
1906.081,
|
||||
861.641,
|
||||
864.233,
|
||||
844.411,
|
||||
813.144,
|
||||
830.783,
|
||||
842.3,
|
||||
878.226
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 876.143,
|
||||
"p25": 862.934,
|
||||
"p75": 891.4,
|
||||
"min": 837.769,
|
||||
"max": 1517.372,
|
||||
"samples": [
|
||||
1517.372,
|
||||
885.13,
|
||||
887.888,
|
||||
865.404,
|
||||
837.769,
|
||||
855.526,
|
||||
867.157,
|
||||
901.937
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 273904.0,
|
||||
"p25": 273717.0,
|
||||
"p75": 274142.0,
|
||||
"min": 273648,
|
||||
"max": 274836,
|
||||
"samples": [
|
||||
273648,
|
||||
273936,
|
||||
273872,
|
||||
274836,
|
||||
274064,
|
||||
274376,
|
||||
273740,
|
||||
273648
|
||||
]
|
||||
}
|
||||
},
|
||||
"cd61e11b": {
|
||||
"phase_ms": {
|
||||
"median": 422.356,
|
||||
"p25": 406.294,
|
||||
"p75": 425.846,
|
||||
"min": 394.111,
|
||||
"max": 472.536,
|
||||
"samples": [
|
||||
425.832,
|
||||
420.666,
|
||||
472.536,
|
||||
425.886,
|
||||
400.588,
|
||||
394.111,
|
||||
424.047,
|
||||
408.196
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 852.475,
|
||||
"p25": 828.474,
|
||||
"p75": 876.413,
|
||||
"min": 817.3,
|
||||
"max": 951.587,
|
||||
"samples": [
|
||||
951.587,
|
||||
865.442,
|
||||
899.564,
|
||||
868.696,
|
||||
823.74,
|
||||
817.3,
|
||||
839.508,
|
||||
830.052
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 875.04,
|
||||
"p25": 850.012,
|
||||
"p75": 900.57,
|
||||
"min": 837.672,
|
||||
"max": 938.285,
|
||||
"samples": [
|
||||
938.285,
|
||||
888.533,
|
||||
926.846,
|
||||
891.812,
|
||||
845.956,
|
||||
837.672,
|
||||
861.548,
|
||||
851.364
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 268086.0,
|
||||
"p25": 267719.0,
|
||||
"p75": 268486.0,
|
||||
"min": 267444,
|
||||
"max": 268920,
|
||||
"samples": [
|
||||
267776,
|
||||
268660,
|
||||
267752,
|
||||
268920,
|
||||
268428,
|
||||
268396,
|
||||
267444,
|
||||
267620
|
||||
]
|
||||
}
|
||||
},
|
||||
"arc-key": {
|
||||
"phase_ms": {
|
||||
"median": 421.422,
|
||||
"p25": 401.781,
|
||||
"p75": 451.774,
|
||||
"min": 394.041,
|
||||
"max": 472.337,
|
||||
"samples": [
|
||||
446.155,
|
||||
472.337,
|
||||
468.632,
|
||||
420.636,
|
||||
400.91,
|
||||
394.041,
|
||||
422.207,
|
||||
402.072
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 866.601,
|
||||
"p25": 822.563,
|
||||
"p75": 918.038,
|
||||
"min": 817.092,
|
||||
"max": 1001.287,
|
||||
"samples": [
|
||||
1001.287,
|
||||
918.457,
|
||||
917.898,
|
||||
892.666,
|
||||
817.092,
|
||||
824.225,
|
||||
840.536,
|
||||
817.576
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 887.84,
|
||||
"p25": 844.533,
|
||||
"p75": 937.331,
|
||||
"min": 838.687,
|
||||
"max": 991.212,
|
||||
"samples": [
|
||||
991.212,
|
||||
949.048,
|
||||
933.425,
|
||||
911.921,
|
||||
838.687,
|
||||
845.021,
|
||||
863.759,
|
||||
843.069
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 267728.0,
|
||||
"p25": 267598.0,
|
||||
"p75": 268039.0,
|
||||
"min": 267452,
|
||||
"max": 268636,
|
||||
"samples": [
|
||||
268264,
|
||||
267616,
|
||||
267840,
|
||||
267964,
|
||||
268636,
|
||||
267452,
|
||||
267580,
|
||||
267604
|
||||
]
|
||||
}
|
||||
},
|
||||
"reused-sounds": {
|
||||
"phase_ms": {
|
||||
"median": 421.683,
|
||||
"p25": 412.913,
|
||||
"p75": 439.098,
|
||||
"min": 395.338,
|
||||
"max": 487.446,
|
||||
"samples": [
|
||||
487.446,
|
||||
434.111,
|
||||
402.815,
|
||||
416.279,
|
||||
424.524,
|
||||
454.058,
|
||||
395.338,
|
||||
418.842
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 879.846,
|
||||
"p25": 845.021,
|
||||
"p75": 901.166,
|
||||
"min": 823.721,
|
||||
"max": 1013.539,
|
||||
"samples": [
|
||||
1013.539,
|
||||
892.033,
|
||||
928.565,
|
||||
884.284,
|
||||
847.853,
|
||||
875.407,
|
||||
823.721,
|
||||
836.527
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 894.546,
|
||||
"p25": 871.499,
|
||||
"p75": 921.844,
|
||||
"min": 844.891,
|
||||
"max": 1028.688,
|
||||
"samples": [
|
||||
1028.688,
|
||||
913.48,
|
||||
946.935,
|
||||
903.785,
|
||||
868.684,
|
||||
885.308,
|
||||
844.891,
|
||||
872.438
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 267960.0,
|
||||
"p25": 267678.0,
|
||||
"p75": 268133.0,
|
||||
"min": 267212,
|
||||
"max": 268404,
|
||||
"samples": [
|
||||
267212,
|
||||
267888,
|
||||
268404,
|
||||
267692,
|
||||
268096,
|
||||
267636,
|
||||
268244,
|
||||
268032
|
||||
]
|
||||
}
|
||||
},
|
||||
"current": {
|
||||
"phase_ms": {
|
||||
"median": 411.403,
|
||||
"p25": 406.814,
|
||||
"p75": 452.869,
|
||||
"min": 391.768,
|
||||
"max": 532.402,
|
||||
"samples": [
|
||||
532.402,
|
||||
442.563,
|
||||
408.857,
|
||||
410.202,
|
||||
483.788,
|
||||
391.768,
|
||||
400.683,
|
||||
412.604
|
||||
]
|
||||
},
|
||||
"total_ms": {
|
||||
"median": 905.017,
|
||||
"p25": 851.488,
|
||||
"p75": 937.934,
|
||||
"min": 818.206,
|
||||
"max": 1075.445,
|
||||
"samples": [
|
||||
1075.445,
|
||||
878.155,
|
||||
837.627,
|
||||
955.655,
|
||||
932.027,
|
||||
818.206,
|
||||
856.108,
|
||||
931.88
|
||||
]
|
||||
},
|
||||
"cpu_ms": {
|
||||
"median": 922.9,
|
||||
"p25": 874.849,
|
||||
"p75": 956.282,
|
||||
"min": 839.639,
|
||||
"max": 1067.693,
|
||||
"samples": [
|
||||
1067.693,
|
||||
900.18,
|
||||
862.137,
|
||||
970.356,
|
||||
951.591,
|
||||
839.639,
|
||||
879.086,
|
||||
945.62
|
||||
]
|
||||
},
|
||||
"peak_rss_kib": {
|
||||
"median": 268354.0,
|
||||
"p25": 267889.0,
|
||||
"p75": 268492.0,
|
||||
"min": 267056,
|
||||
"max": 268820,
|
||||
"samples": [
|
||||
268008,
|
||||
268384,
|
||||
268564,
|
||||
268820,
|
||||
267056,
|
||||
267532,
|
||||
268324,
|
||||
268468
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"experiment_note": "Exploratory variants (Arc-key pool, reused sounds, combined proposal) alongside cd61e11b; none gave a robust consistent improvement and all were reverted."
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//! Profile the two mandatory passes over gameplay-facts.json independently.
|
||||
//! Build with `cargo build --release -p horizon-client --example gameplay_decode_profile`.
|
||||
//! Each invocation runs one phase in a separate process for CPU/RSS measurements.
|
||||
#[allow(dead_code)]
|
||||
#[path = "../src/blocks/decode.rs"]
|
||||
mod decode;
|
||||
|
||||
use std::{hint::black_box, path::Path, time::Instant};
|
||||
|
||||
// The included private decoder expects the parent crate Result alias.
|
||||
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let root = args.next().ok_or("expected resource directory")?;
|
||||
let mode = args.next().ok_or("expected validate or typed")?;
|
||||
if mode != "validate" && mode != "typed" {
|
||||
return Err("expected validate or typed".into());
|
||||
}
|
||||
let total = Instant::now();
|
||||
let bytes = std::fs::read(Path::new(&root).join("gameplay-facts.json"))?;
|
||||
let started = Instant::now();
|
||||
if mode == "validate" {
|
||||
let parsed: decode::Validate = serde_json::from_slice(&bytes)?;
|
||||
black_box(parsed);
|
||||
} else {
|
||||
let parsed: decode::Gameplay<'_> = serde_json::from_slice(&bytes)?;
|
||||
black_box(parsed);
|
||||
}
|
||||
println!("phase_ms={:.3}", started.elapsed().as_secs_f64() * 1000.0);
|
||||
println!("total_ms={:.3}", total.elapsed().as_secs_f64() * 1000.0);
|
||||
Ok(())
|
||||
}
|
||||
@@ -6,19 +6,27 @@ use horizon_client::{assets::Assets, blocks::BlockFacts};
|
||||
use horizon_world::level::Behaviours;
|
||||
use std::{path::Path, time::Instant};
|
||||
|
||||
fn resident_kib() -> Option<u64> {
|
||||
let status = std::fs::read_to_string("/proc/self/status").ok()?;
|
||||
let line = status.lines().find(|line| line.starts_with("VmRSS:"))?;
|
||||
line.split_whitespace().nth(1)?.parse().ok()
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let root = args.next().ok_or("expected resource directory")?;
|
||||
let mode = args
|
||||
.next()
|
||||
.ok_or("expected baseline, pr607, shared or deferred")?;
|
||||
if !["baseline", "pr607", "shared", "deferred"].contains(&mode.as_str()) {
|
||||
return Err("expected baseline, pr607, shared or deferred".into());
|
||||
.ok_or("expected baseline, pr607, shared, deferred or deferred-held")?;
|
||||
if !["baseline", "pr607", "shared", "deferred", "deferred-held"].contains(&mode.as_str()) {
|
||||
return Err("expected baseline, pr607, shared, deferred or deferred-held".into());
|
||||
}
|
||||
let root = Path::new(&root);
|
||||
let total = Instant::now();
|
||||
let assets = Assets::load(root)?;
|
||||
let started = Instant::now();
|
||||
let mut retained_inputs = None;
|
||||
let mut subphases = None;
|
||||
let (facts, behaviours) = if mode == "baseline" {
|
||||
(
|
||||
BlockFacts::load(root, assets.registry)?,
|
||||
@@ -33,16 +41,34 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
} else if mode == "shared" {
|
||||
BlockFacts::load_pair(root, assets.registry)?
|
||||
} else {
|
||||
let parse_started = Instant::now();
|
||||
let json: serde_json::Value = serde_json::from_reader(std::io::BufReader::new(
|
||||
std::fs::File::open(root.join("block-behaviours.json"))?,
|
||||
))?;
|
||||
let parse_ms = parse_started.elapsed().as_secs_f64() * 1000.0;
|
||||
let facts_started = Instant::now();
|
||||
let (facts, gameplay) = BlockFacts::load_with_projection(root, assets.registry, &json)?;
|
||||
let facts_ms = facts_started.elapsed().as_secs_f64() * 1000.0;
|
||||
let behaviours_started = Instant::now();
|
||||
let behaviours = Behaviours::load_with_gameplay(assets.registry, root, &json, &gameplay)?;
|
||||
let behaviours_ms = behaviours_started.elapsed().as_secs_f64() * 1000.0;
|
||||
subphases = Some((parse_ms, facts_ms, behaviours_ms));
|
||||
if mode == "deferred-held" {
|
||||
retained_inputs = Some((json, gameplay));
|
||||
}
|
||||
(facts, behaviours)
|
||||
};
|
||||
println!("phase_ms={:.3}", started.elapsed().as_secs_f64() * 1000.0);
|
||||
println!("total_ms={:.3}", total.elapsed().as_secs_f64() * 1000.0);
|
||||
println!("states={}", facts.states.len());
|
||||
std::hint::black_box((facts, behaviours));
|
||||
if let Some((parse, facts, behaviours)) = subphases {
|
||||
println!("behaviour_json_ms={parse:.3}");
|
||||
println!("facts_ms={facts:.3}");
|
||||
println!("behaviours_ms={behaviours:.3}");
|
||||
}
|
||||
if let Some(rss) = resident_kib() {
|
||||
println!("post_rss_kib={rss}");
|
||||
}
|
||||
std::hint::black_box((facts, behaviours, retained_inputs));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -10257,6 +10257,10 @@ pub fn run() -> Result<()> {
|
||||
player_arm: horizon_client::mobs::load_model(&root, "minecraft:player#main")
|
||||
.and_then(|m| m.children.into_iter().find(|c| c.name == "right_arm")),
|
||||
});
|
||||
// Both inputs are needed only while constructing the behaviour tables.
|
||||
// Release their owned JSON/Arc buffers before entering the long-lived game loop.
|
||||
drop(gameplay_projection);
|
||||
drop(behaviour_json);
|
||||
let mut settings = Settings::load(&std::env::current_dir()?.join("options.txt"));
|
||||
horizon_client::ui_theme::load_preferences(&std::env::current_dir()?);
|
||||
// Scripted and frame-limited runs (the parity harnesses) see vanilla's
|
||||
|
||||
@@ -341,13 +341,27 @@ fn independent_reloads_read_changed_behaviour_json_and_report_invalid_files() {
|
||||
let original = fs::read(base.join("block-behaviours.json")).unwrap();
|
||||
fs::remove_file(scratch.join("block-behaviours.json")).unwrap();
|
||||
fs::write(scratch.join("block-behaviours.json"), &original).unwrap();
|
||||
let (facts, _) = BlockFacts::load_pair(&scratch, registry).unwrap();
|
||||
// Independent facts and behaviours can load first, followed by paired data.
|
||||
let independent_first = BlockFacts::load(&scratch, registry).unwrap();
|
||||
let independent_world_first =
|
||||
horizon_world::level::Behaviours::load(registry, &scratch).unwrap();
|
||||
let (facts, paired_world) = BlockFacts::load_pair(&scratch, registry).unwrap();
|
||||
assert_eq!(facts.states.len(), registry.len());
|
||||
assert_eq!(
|
||||
BlockFacts::load(&scratch, registry).unwrap().states.len(),
|
||||
registry.len()
|
||||
);
|
||||
assert!(horizon_world::level::Behaviours::load(registry, &scratch).is_ok());
|
||||
for state in [0, 1, registry.len() - 1] {
|
||||
let state = horizon_world::registry::BlockStateId(state as u32);
|
||||
assert_eq!(
|
||||
facts.get(state).classes,
|
||||
independent_first.get(state).classes
|
||||
);
|
||||
assert_eq!(
|
||||
facts.get(state).sounds.place,
|
||||
independent_first.get(state).sounds.place
|
||||
);
|
||||
assert_eq!(
|
||||
paired_world.facts(state).flags,
|
||||
independent_world_first.facts(state).flags
|
||||
);
|
||||
}
|
||||
|
||||
// Override one exported state bit at the same path and verify that a later
|
||||
// independent and paired read sees it while the original resource root does not.
|
||||
@@ -379,8 +393,15 @@ fn independent_reloads_read_changed_behaviour_json_and_report_invalid_files() {
|
||||
);
|
||||
|
||||
fs::write(scratch.join("block-behaviours.json"), b"{").unwrap();
|
||||
assert!(BlockFacts::load_pair(&scratch, registry).is_err());
|
||||
assert!(BlockFacts::load(&scratch, registry).is_err());
|
||||
let paired_error = BlockFacts::load_pair(&scratch, registry)
|
||||
.err()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
let independent_error = BlockFacts::load(&scratch, registry)
|
||||
.err()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
assert_eq!(paired_error, independent_error);
|
||||
assert!(horizon_world::level::Behaviours::load(registry, &scratch).is_err());
|
||||
|
||||
fs::write(scratch.join("block-behaviours.json"), b"{}").unwrap();
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare four JSON loading sequences in the client startup table phase.
|
||||
"""Profile the asset/block-facts/behaviour loading phase in release executables.
|
||||
|
||||
Build first with `cargo build --release -p horizon-client --example shared_json_startup_profile`.
|
||||
Modes: baseline uses independent public loaders, pr607 reproduces a01d47f2,
|
||||
shared uses the paired wrapper, and deferred retains the projection until the
|
||||
normal behaviour stage. All modes use one optimized executable. This covers
|
||||
Assets::load plus BlockFacts and Behaviours loading; it excludes full startup,
|
||||
rendering, resource-pack resolution and first frame. Peak RSS includes Assets.
|
||||
Build `shared_json_startup_profile` with the same Cargo release profile at each
|
||||
revision. With --a01-binary, --cf-binary and --cd-binary, the script compares
|
||||
five versions in alternated separate processes; --baseline-binary optionally
|
||||
supplies a build from the original pre-PR checkout. Without historical inputs,
|
||||
legacy baseline/pr607/shared/deferred same-binary comparisons are supported.
|
||||
The measurement excludes full client startup, renderer and first frame.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import statistics
|
||||
@@ -19,20 +20,32 @@ from pathlib import Path
|
||||
|
||||
def run(binary, resources, mode):
|
||||
with tempfile.TemporaryFile(mode="w+t") as output:
|
||||
proc = subprocess.Popen([str(binary), str(resources), mode], stdout=output, stderr=subprocess.PIPE)
|
||||
proc = subprocess.Popen([str(binary), str(resources), mode], stdout=output,
|
||||
stderr=subprocess.PIPE)
|
||||
_, status, usage = os.wait4(proc.pid, 0)
|
||||
proc.returncode = os.waitstatus_to_exitcode(status)
|
||||
_, stderr = proc.communicate()
|
||||
if os.waitstatus_to_exitcode(status):
|
||||
raise RuntimeError(f"{mode}: {stderr.decode(errors='replace')}")
|
||||
if proc.returncode:
|
||||
raise RuntimeError(f"{binary} {mode}: {stderr.decode(errors='replace')}")
|
||||
output.seek(0)
|
||||
fields = dict(line.rstrip().split("=", 1) for line in output if "=" in line)
|
||||
return {
|
||||
measurements = {
|
||||
"phase_ms": float(fields["phase_ms"]),
|
||||
"total_ms": float(fields["total_ms"]),
|
||||
"cpu_ms": (usage.ru_utime + usage.ru_stime) * 1000.0,
|
||||
"peak_rss_kib": usage.ru_maxrss,
|
||||
}
|
||||
for field in ("behaviour_json_ms", "facts_ms", "behaviours_ms", "post_rss_kib"):
|
||||
if field in fields:
|
||||
measurements[field] = float(fields[field])
|
||||
return measurements
|
||||
|
||||
|
||||
def percentile(values, percent):
|
||||
ordered = sorted(values)
|
||||
position = (len(ordered) - 1) * percent
|
||||
low = int(position)
|
||||
return ordered[low] + (ordered[min(low + 1, len(ordered) - 1)] - ordered[low]) * (position - low)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -40,43 +53,93 @@ def main():
|
||||
parser.add_argument("--binary", type=Path, default=Path("target/release/examples/shared_json_startup_profile"))
|
||||
parser.add_argument("--resources", type=Path, default=Path(".local/horizon-client/26.3"))
|
||||
parser.add_argument("--repeats", type=int, default=5)
|
||||
parser.add_argument("--reference-binary", type=Path,
|
||||
help="Release binary built from cf837118; compare its deferred mode against current")
|
||||
parser.add_argument("--reference-binary", type=Path, help="Legacy comparison to cf837118")
|
||||
parser.add_argument("--baseline-binary", type=Path, help="Optional original main build; expects baseline mode")
|
||||
parser.add_argument("--a01-binary", type=Path, help="Release executable built at a01d47f2")
|
||||
parser.add_argument("--cf-binary", type=Path, help="Release executable built at cf837118")
|
||||
parser.add_argument("--cd-binary", type=Path, help="Release executable built at cd61e11b")
|
||||
parser.add_argument("--variant", action="append", metavar="LABEL=PATH@MODE",
|
||||
help="Compare arbitrary release variants, e.g. pool=target/...@deferred")
|
||||
parser.add_argument("--output", type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.repeats < 1:
|
||||
parser.error("--repeats must be positive")
|
||||
binary, resources = args.binary.resolve(), args.resources.resolve()
|
||||
if not binary.is_file() or not resources.is_dir():
|
||||
parser.error("binary or resources missing; build the example and prepare resources first")
|
||||
if args.reference_binary:
|
||||
reference = args.reference_binary.resolve()
|
||||
if not reference.is_file():
|
||||
parser.error("reference binary missing")
|
||||
modes = ["baseline", "pr607", "cf837118", "current"]
|
||||
if not resources.is_dir():
|
||||
parser.error("resources directory missing")
|
||||
|
||||
historical = any((args.a01_binary, args.cf_binary, args.cd_binary, args.baseline_binary))
|
||||
if args.variant:
|
||||
if historical or args.reference_binary:
|
||||
parser.error("--variant cannot be mixed with historical comparison flags")
|
||||
commands = {}
|
||||
for specification in args.variant:
|
||||
if "=" not in specification or "@" not in specification:
|
||||
parser.error("--variant must be LABEL=PATH@MODE")
|
||||
name, executable_mode = specification.split("=", 1)
|
||||
executable, binary_mode = executable_mode.rsplit("@", 1)
|
||||
if not name or not executable or not binary_mode or name in commands:
|
||||
parser.error("variant names must be unique and all fields nonempty")
|
||||
commands[name] = (Path(executable).resolve(), binary_mode)
|
||||
elif historical:
|
||||
if not all((args.a01_binary, args.cf_binary, args.cd_binary)):
|
||||
parser.error("historical comparisons require --a01-binary, --cf-binary and --cd-binary")
|
||||
commands = {
|
||||
"baseline": ((args.baseline_binary or args.a01_binary).resolve(), "baseline"),
|
||||
"a01d47f2": (args.a01_binary.resolve(), "shared"),
|
||||
"cf837118": (args.cf_binary.resolve(), "deferred"),
|
||||
"cd61e11b": (args.cd_binary.resolve(), "deferred"),
|
||||
"current": (binary, "deferred"),
|
||||
}
|
||||
elif args.reference_binary:
|
||||
commands = {
|
||||
"baseline": (binary, "baseline"),
|
||||
"pr607": (binary, "pr607"),
|
||||
"cf837118": (reference, "deferred"),
|
||||
"cf837118": (args.reference_binary.resolve(), "deferred"),
|
||||
"current": (binary, "deferred"),
|
||||
}
|
||||
else:
|
||||
modes = ["baseline", "pr607", "shared", "deferred"]
|
||||
commands = {mode: (binary, mode) for mode in modes}
|
||||
commands = {mode: (binary, mode) for mode in ("baseline", "pr607", "shared", "deferred")}
|
||||
for executable, _ in commands.values():
|
||||
if not executable.is_file():
|
||||
parser.error(f"release executable missing: {executable}")
|
||||
modes = list(commands)
|
||||
samples = {mode: [] for mode in modes}
|
||||
orders = []
|
||||
initial_load = os.getloadavg()
|
||||
for i in range(args.repeats):
|
||||
for mode in (modes if i % 2 == 0 else list(reversed(modes))):
|
||||
order = modes if i % 2 == 0 else list(reversed(modes))
|
||||
orders.append(list(order))
|
||||
for mode in order:
|
||||
executable, binary_mode = commands[mode]
|
||||
samples[mode].append(run(executable, resources, binary_mode))
|
||||
result = {
|
||||
"scope": "Assets + block facts + behaviours loader only; excludes full startup",
|
||||
"scope": "Assets + BlockFacts + Behaviours loader only; no full startup or first frame",
|
||||
"resources": str(resources),
|
||||
"repeats": args.repeats,
|
||||
"comparison": "historical cf837118 release binary" if args.reference_binary else "same binary loading modes",
|
||||
"reference_binary": str(args.reference_binary) if args.reference_binary else None,
|
||||
"metrics": {mode: {key: {"median": round(statistics.median(row[key] for row in rows), 3),
|
||||
"samples": [round(row[key], 3) for row in rows]}
|
||||
for key in rows[0]} for mode, rows in samples.items()},
|
||||
"ordering": orders,
|
||||
"load_average_before": initial_load,
|
||||
"load_average_after": os.getloadavg(),
|
||||
"executables": {
|
||||
mode: {"path": str(executable), "mode": binary_mode,
|
||||
"sha256": hashlib.sha256(executable.read_bytes()).hexdigest()}
|
||||
for mode, (executable, binary_mode) in commands.items()
|
||||
},
|
||||
"metrics": {
|
||||
mode: {
|
||||
key: {
|
||||
"median": round(statistics.median(values), 3),
|
||||
"p25": round(percentile(values, .25), 3),
|
||||
"p75": round(percentile(values, .75), 3),
|
||||
"min": round(min(values), 3),
|
||||
"max": round(max(values), 3),
|
||||
"samples": [round(value, 3) for value in values],
|
||||
}
|
||||
for key in rows[0]
|
||||
for values in [[row[key] for row in rows]]
|
||||
}
|
||||
for mode, rows in samples.items()
|
||||
},
|
||||
}
|
||||
data = json.dumps(result, indent=2)
|
||||
print(data)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Profile the validation and typed-deserialization passes in separate processes.
|
||||
|
||||
Build `cargo build --release -p horizon-client --example gameplay_decode_profile`
|
||||
then run this tool with the matching prepared resources. These passes are
|
||||
both currently required for exact JSON error classification/precedence.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import statistics
|
||||
from pathlib import Path
|
||||
from profile_client_startup import percentile, run
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--binary", type=Path,
|
||||
default=Path("target/release/examples/gameplay_decode_profile"))
|
||||
parser.add_argument("--resources", type=Path, default=Path(".local/horizon-client/26.3"))
|
||||
parser.add_argument("--repeats", type=int, default=8)
|
||||
parser.add_argument("--output", type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.repeats < 1:
|
||||
parser.error("--repeats must be positive")
|
||||
binary, resources = args.binary.resolve(), args.resources.resolve()
|
||||
if not binary.is_file() or not resources.is_dir():
|
||||
parser.error("release example or resources missing")
|
||||
modes = ("validate", "typed")
|
||||
samples = {mode: [] for mode in modes}
|
||||
loads = [os.getloadavg()]
|
||||
for i in range(args.repeats):
|
||||
for mode in (modes if i % 2 == 0 else reversed(modes)):
|
||||
samples[mode].append(run(binary, resources, mode))
|
||||
loads.append(os.getloadavg())
|
||||
result = {
|
||||
"scope": "Isolated gameplay-facts.json validation/typed decoding; includes JSON file read",
|
||||
"resources": str(resources),
|
||||
"repeats": args.repeats,
|
||||
"load_averages_before_after": loads,
|
||||
"binary_sha256": hashlib.sha256(binary.read_bytes()).hexdigest(),
|
||||
"metrics": {
|
||||
mode: {
|
||||
key: {"median": round(statistics.median(values), 3),
|
||||
"p25": round(percentile(values, .25), 3),
|
||||
"p75": round(percentile(values, .75), 3),
|
||||
"min": round(min(values), 3), "max": round(max(values), 3),
|
||||
"samples": [round(x, 3) for x in values]}
|
||||
for key in rows[0]
|
||||
for values in [[row[key] for row in rows]]
|
||||
}
|
||||
for mode, rows in samples.items()
|
||||
},
|
||||
}
|
||||
data = json.dumps(result, indent=2)
|
||||
print(data)
|
||||
if args.output:
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(data + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user