Commit e3572ae
committed
perf: inline has_checksumming_support check to avoid classmethod call overhead
Replace ProtocolVersion.has_checksumming_support(protocol_version) calls
in encode_message and decode_message with inline integer comparisons
using pre-computed module-level constants. This avoids the classmethod
dispatch overhead on every encode/decode call.
Benchmark:
classmethod call: 61.3 ns
inline compare: 25.5 ns
saving: 35.8 ns/call (2.4x)1 parent 2b4e88b commit e3572ae
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
1100 | 1106 | | |
1101 | 1107 | | |
1102 | 1108 | | |
1103 | | - | |
| 1109 | + | |
1104 | 1110 | | |
1105 | 1111 | | |
1106 | 1112 | | |
| |||
1149 | 1155 | | |
1150 | 1156 | | |
1151 | 1157 | | |
1152 | | - | |
| 1158 | + | |
1153 | 1159 | | |
1154 | 1160 | | |
1155 | 1161 | | |
| |||
0 commit comments