- Notifications
You must be signed in to change notification settings - Fork28
Commit0ce3873
committed
Micro-optimize AllocSetFreeIndex() by reference to pg_bitutils code.
Use __builtin_clz() where available. Where it isn't, we can still wina little by using the pg_leftmost_one_pos[] lookup table instead ofhaving a private table.Also drop the initial right shift by ALLOC_MINBITS in favor ofsubtracting ALLOC_MINBITS from the leftmost-one-pos result. Thisis a win because the compiler can fold that adjustment into otherconstants it'd have to add anyway, making the shift-removal free.Also, we can explain this coding as an unrolled form ofpg_leftmost_one_pos32(), even though that's a bit ahistoricalsince it long predates pg_bitutils.h.John Naylor, with some cosmetic adjustments by meDiscussion:https://postgr.es/m/CACPNZCuNUGMxjK7WTn_=WZnRbfASDdBxmjsVf2+m9MdmeNw_sg@mail.gmail.com1 parent27a3b2a commit0ce3873
1 file changed
+31
-25
lines changedLines changed: 31 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
| 49 | + | |
49 | 50 |
| |
50 | 51 |
| |
51 | 52 |
| |
| |||
297 | 298 |
| |
298 | 299 |
| |
299 | 300 |
| |
300 |
| - | |
301 |
| - | |
302 |
| - | |
303 |
| - | |
304 |
| - | |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 | 301 |
| |
313 | 302 |
| |
314 | 303 |
| |
| |||
337 | 326 |
| |
338 | 327 |
| |
339 | 328 |
| |
340 |
| - | |
341 |
| - | |
342 | 329 |
| |
343 | 330 |
| |
344 | 331 |
| |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
355 | 348 |
| |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
356 | 360 |
| |
357 |
| - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
358 | 364 |
| |
359 | 365 |
| |
360 | 366 |
| |
|
0 commit comments
Comments
(0)