Commit 012d6d50 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #298 from toshok/three-arenas

Add third GC arena
parents 7cf92757 d85c9893
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)
......@@ -51,6 +51,11 @@ extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) {
#endif
GCAllocation* alloc = global_heap.alloc(alloc_bytes);
#ifndef NVALGRIND
VALGRIND_DISABLE_ERROR_REPORTING;
#endif
alloc->kind_id = kind_id;
alloc->gc_flags = 0;
......@@ -67,7 +72,10 @@ extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) {
}
void* r = alloc->user_data;
#ifndef NVALGRIND
VALGRIND_ENABLE_ERROR_REPORTING;
if (ENABLE_REDZONES) {
r = ((char*)r) + REDZONE_SIZE;
}
......
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