Commit d716b35
committed
Avoid dynamic memcpy in varint encoding
This improves the write performance by about 12% in local tests, putting
varints almost on par with fixed integers (at least from PHP land).
In order to do this safely, we need to be certain that the encoding is
going to succeed. The reason this was previously encoded on the stack
first is to make sure that the function didn't corrupt people's data by
terminating due to an error. This shouldn't be possible when we force
TValue to be an unsigned type (avoiding the sort of arithmetic
right-shifting bugs that plagued PM in the 0.16 days).1 parent a7c6198 commit d716b35
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
| 273 | + | |
| 274 | + | |
271 | 275 | | |
272 | 276 | | |
273 | 277 | | |
| |||
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
281 | | - | |
| 285 | + | |
282 | 286 | | |
283 | 287 | | |
284 | | - | |
285 | | - | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
291 | | - | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | | - | |
295 | | - | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
0 commit comments