forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita365d9e
committed
Speed up tail processing when hashing aligned C strings, take two
After encountering the NUL terminator, the word-at-a-time loop exitsand we must hash the remaining bytes. Previously we calculatedthe terminator's position and re-loaded the remaining bytes fromthe input string. This was slower than the unaligned case for veryshort strings. We already have all the data we need in a register,so let's just mask off the bytes we need and hash them immediately.In addition to endianness issues, the previous attempt upset valgrindin the way it computed the mask. Whether by accident or by wisdom,the author's proposed method passes locally with valgrind 3.22.Ants Aasma, with cosmetic adjustments by meDiscussion:https://postgr.es/m/CANwKhkP7pCiW_5fAswLhs71-JKGEz1c1%2BPC0a_w1fwY4iGMqUA%40mail.gmail.com1 parent0c25fee commita365d9e
1 file changed
+36
-10
lines changedLines changed: 36 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
222 | 229 |
| |
223 | 230 |
| |
224 | 231 |
| |
| |||
255 | 262 |
| |
256 | 263 |
| |
257 | 264 |
| |
258 |
| - | |
| 265 | + | |
259 | 266 |
| |
260 | 267 |
| |
261 | 268 |
| |
| |||
275 | 282 |
| |
276 | 283 |
| |
277 | 284 |
| |
278 |
| - | |
| 285 | + | |
279 | 286 |
| |
280 | 287 |
| |
281 | 288 |
| |
| |||
290 | 297 |
| |
291 | 298 |
| |
292 | 299 |
| |
293 |
| - | |
294 |
| - | |
295 |
| - | |
296 |
| - | |
297 |
| - | |
298 |
| - | |
299 |
| - | |
300 |
| - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
301 | 327 |
| |
302 | 328 |
| |
303 | 329 |
| |
|
0 commit comments
Comments
(0)