From a2b56f97406b79109b0ce55a4f308d3222adebcb Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 29 Jan 2020 11:25:13 +0000 Subject: [PATCH] Remove a notify_using that regressed perf The performance on Windows was significantly regressed by the notify_using during the bump allocation. This change removes that. It appears that the pages are already committed by the large allocator. --- src/mem/slab.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mem/slab.h b/src/mem/slab.h index 7d0db15..5bcbd24 100644 --- a/src/mem/slab.h +++ b/src/mem/slab.h @@ -68,8 +68,10 @@ namespace snmalloc } else { + // Allocate the last object on the current page if there is one, + // and then thread the next free list worth of allocations. + bool crossed_page_boundary = false; void* curr = nullptr; - bool commit = false; while (true) { size_t newbumpptr = bumpptr + rsize; @@ -78,15 +80,12 @@ namespace snmalloc if (alignedbumpptr != alignednewbumpptr) { - // We have committed once already. - if (commit) + // We have crossed a page boundary already, so + // lets stop building our free list. + if (crossed_page_boundary) break; - memory_provider.template notify_using( - pointer_offset(this, alignedbumpptr), - alignednewbumpptr - alignedbumpptr); - - commit = true; + crossed_page_boundary = true; } if (curr == nullptr)