On Sat, 18 Oct 2025 at 12:50, Xuneng Zhou <[email protected]> wrote: > > Hi Hackers,
Hi! > The SnapBuildPurgeOlderTxn function previously used a suboptimal > method to remove old XIDs from the committed.xip array. It allocated a > temporary workspace array, copied the surviving elements into it, and > then copied them back, incurring unnecessary memory allocation and > multiple data copies. > > This patch refactors the logic to use a standard two-pointer, in-place > compaction algorithm. The new approach filters the array in a single > pass with no extra memory allocation, improving both CPU and memory > efficiency. > > No behavioral changes are expected. This resolves a TODO comment > expecting a more efficient algorithm. > Indeed, these changes look correct. I wonder why b89e151054a0 did this place this way, hope we do not miss anything here. Can we construct a microbenchmark here which will show some benefit? -- Best regards, Kirill Reshke
