Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Added exponential policy - 10% speed improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Cimon committed Jun 4, 2014
1 parent 400b4b5 commit 4d793a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ struct Gcx
* Sort it into pooltable[].
* Return null if failed.
*/
Pool *newPool(size_t npages, bool isLargeObject) nothrow
Pool *newPool(size_t npages, bool isLargeObject, bool isOOM = false) nothrow
{
Pool* pool;
Pool** newpooltable;
Expand All @@ -2185,12 +2185,12 @@ struct Gcx
}

// Allocate successively larger pools up to 8 megs
if (npools)
if (!isOOM && npools)
{ size_t n;

n = npools;
if (n > 32)
n = 32; // cap pool size at 32 megs
n *= n;
else if (n > 8)
n = 16;
n *= (POOLSIZE / PAGESIZE);
Expand Down Expand Up @@ -2232,6 +2232,8 @@ struct Gcx
Lerr:
pool.Dtor();
cstdlib.free(pool);
if (!isOOM)
newPool(npages, isLargeObject, true);
return null;
}

Expand Down

0 comments on commit 4d793a3

Please sign in to comment.