allocators: introduce --define:nimMinHeapPages for tuning mmap calls (omg they are slow on OSX...)
This commit is contained in:
parent
86a91c1a4a
commit
f7c0360aba
2 changed files with 29 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ template track(op, address, size) =
|
|||
# Each chunk starts at an address that is divisible by the page size.
|
||||
|
||||
const
|
||||
InitialMemoryRequest = 128 * PageSize # 0.5 MB
|
||||
nimMinHeapPages {.intdefine.} = 128 # 0.5 MB
|
||||
SmallChunkSize = PageSize
|
||||
MaxFli = 30
|
||||
MaxLog2Sli = 5 # 32, this cannot be increased without changing 'uint32'
|
||||
|
|
@ -588,8 +588,8 @@ proc getBigChunk(a: var MemRegion, size: int): PBigChunk =
|
|||
sysAssert((size and PageMask) == 0, "getBigChunk: unaligned chunk")
|
||||
result = findSuitableBlock(a, fl, sl)
|
||||
if result == nil:
|
||||
if size < InitialMemoryRequest:
|
||||
result = requestOsChunks(a, InitialMemoryRequest)
|
||||
if size < nimMinHeapPages * PageSize:
|
||||
result = requestOsChunks(a, nimMinHeapPages * PageSize)
|
||||
splitChunk(a, result, size)
|
||||
else:
|
||||
result = requestOsChunks(a, size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue