Commit f4eb034
authored
perf(cubeorchestrator): Hand-written Deserialize for DBResponsePrimitive (-95%, ~20x parse) (#10853)
The derived `#[serde(untagged)]` impl funnels every value through `serde::__private::de::Content`, materializing an intermediate tree per element. For wire payloads dominated by strings/numbers/null (the common CubeStore row shape) that buffering is the bottleneck. A direct `Visitor` dispatches on the JSON token in one pass; only the rare seq/map branches pay the `Value`-materialization cost via `Uncommon`.
Measured on `QueryResult::from_js_raw_data` bench (criterion, 100 samples
for c16; --quick elsewhere):
| Bench | Before | After | Difference | Speedup | Faster by |
| ------------------------------ | ---------- | --------- | ----------- | ------- | --------- |
| parse_only / c08_r10000 | 39.80 ms | 1.96 ms | -37.84 ms | ~20x | -95.1% |
| parse_plus_build / c08_r10000 | 39.99 ms | 2.25 ms | -37.74 ms | ~18x | -94.4% |
| parse_only / c16_r10000 | 82.39 ms | 4.03 ms | -78.36 ms | 20.4x | -95.1% |
| parse_plus_build / c16_r10000 | 79.94 ms | 4.79 ms | -75.15 ms | 16.7x | -94.0% |
| parse_only / c16_r100000 | 836.81 ms | 40.25 ms | -796.56 ms | 20.8x | -95.2% |
| parse_plus_build / c16_r100000 | 832.44 ms | 55.58 ms | -776.86 ms | 15.0x | -93.3% |
| parse_only / c32_r100000 | 1662.60 ms | 81.66 ms | -1580.94 ms | ~20x | -95.1% |
| parse_plus_build / c32_r100000 | 1677.50 ms | 114.22 ms | -1563.28 ms | ~15x | -93.2% |
Throughput on pure parse jumps from ~2 Melem/s to ~40 Melem/s. `parse_plus_build` gains less because the transpose into `QueryResult` now dominates once parsing is cheap.1 parent c12e268 commit f4eb034
1 file changed
Lines changed: 92 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
961 | 964 | | |
962 | 965 | | |
963 | 966 | | |
964 | | - | |
| 967 | + | |
965 | 968 | | |
966 | 969 | | |
967 | 970 | | |
| |||
971 | 974 | | |
972 | 975 | | |
973 | 976 | | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
974 | 1064 | | |
975 | 1065 | | |
976 | 1066 | | |
| |||
0 commit comments