Commit 919dd3df authored by Chris Toshok's avatar Chris Toshok

Add a third size class (between small/large) to the gc.

port over sgen's idea of LOSSections as a mid-sized arena, so that we now have:

SmallArena original non-large allocator, free bitmaps, segregated-fit allocator.
  handles objects where size <= 3584 bytes
LargeArena (new code, size-specific free lists.)
  handles object  where 3584 < size <= ~1 meg
HugeArena (original large allocator, 1 mmap per object.
  handles objects where size > ~1meg
parent 4afb0656
import time
PIDIGITS_LEN = 1500
def pidigits(length):
i = k = ns = 0
k1 = 1
n,a,d,t,u = 1,0,1,0,0
while(True):
k += 1
t = n<<1
n *= k
a += t
k1 += 2
a *= k1
d *= k1
if a >= n:
t,u = divmod(n*3 + a,d)
u += n
if d > u:
ns = ns*10 + t
i += 1
if i % 10 == 0:
ns = 0
if i >= length:
break
a -= d*t
a *= 10
n *= 10
def main(n):
l = []
for i in range(n):
t0 = time.time()
pidigits(PIDIGITS_LEN)
l.append(time.time() - t0)
return l
main(100)
This diff is collapsed.
This diff is collapsed.
......@@ -68,6 +68,9 @@ TEST(alloc, alloc64) { testAlloc(64); }
TEST(alloc, alloc128) { testAlloc(128); }
TEST(alloc, alloc258) { testAlloc(258); }
TEST(alloc, alloc3584) { testAlloc(3584); }
TEST(alloc, alloc4096) { testAlloc(4096); }
TEST(alloc, alloc8192) { testAlloc(8192); }
TEST(alloc, alloc16384) { testAlloc(16384); }
TEST(alloc, largeallocs) {
int s1 = 1 << 20;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment