forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0cd954
committed
Optimize GenerationAlloc() and SlabAlloc()
In a similar effort to413c184, separate out the hot and cold paths inGenerationAlloc() and SlabAlloc() to avoid having to setup the stack framefor the hot path.This additionally adjusts how we use the GenerationContext's freeblock.Freeblock, when set, is now always empty and we only switch to using itwhen the current allocation request finds the current block does not haveenough space and the freeblock is large enough to accomodate theallocation.This commit also adjusts GenerationFree() so that if we pfree the finalallocation in the current generation block, we now mark that block asempty and keep it as the current block. Previously we free'd that blockand set the current block to NULL. Doing that meant we needed a specialcase in GenerationAlloc to check if GenerationContext.block was NULL.So this both reduces free/malloc calls and reduces the work done inGenerationAlloc().In passing, improve some comments in aset.cDiscussion:https://postgr.es/m/CAApHDvpHVSJqqb4B4OZLixr=CotKq-eKkbwZqvZVo_biYvUvQA@mail.gmail.com1 parent07c36c1 commita0cd954
3 files changed
+386
-277
lines changedLines changed: 9 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
943 | 943 |
| |
944 | 944 |
| |
945 | 945 |
| |
946 |
| - | |
947 |
| - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
948 | 949 |
| |
949 | 950 |
| |
950 | 951 |
| |
| |||
955 | 956 |
| |
956 | 957 |
| |
957 | 958 |
| |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
963 | 965 |
| |
964 | 966 |
| |
965 | 967 |
| |
|
0 commit comments
Comments
(0)