mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-11 08:55:23 +03:00
Zero whole heap on initialisation
Instead of doing it on every allocation. A small thing, but a noticeable performance gain on building the Blodwen libraries in particular.
This commit is contained in:
parent
03d9188ffb
commit
1980f49f43
@ -110,12 +110,14 @@ void c_heap_destroy(CHeap * heap)
|
||||
void alloc_heap(Heap * h, size_t heap_size, size_t growth, char * old)
|
||||
{
|
||||
char * mem = malloc(heap_size);
|
||||
|
||||
if (mem == NULL) {
|
||||
fprintf(stderr,
|
||||
"RTS ERROR: Unable to allocate heap. Requested %zd bytes.\n",
|
||||
heap_size);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
memset(mem, 0, heap_size);
|
||||
|
||||
h->heap = mem;
|
||||
h->next = aligned_heap_pointer(h->heap);
|
||||
|
@ -209,7 +209,6 @@ void * allocate(size_t sz, int lock) {
|
||||
}
|
||||
|
||||
void* iallocate(VM * vm, size_t isize, int outerlock) {
|
||||
// return malloc(isize);
|
||||
size_t size = aligned(isize);
|
||||
|
||||
#ifdef HAS_PTHREAD
|
||||
@ -225,7 +224,6 @@ void* iallocate(VM * vm, size_t isize, int outerlock) {
|
||||
char* ptr = vm->heap.next;
|
||||
vm->heap.next += size;
|
||||
assert(vm->heap.next <= vm->heap.end);
|
||||
memset(ptr, 0, size);
|
||||
((Hdr*)ptr)->sz = isize;
|
||||
|
||||
#ifdef HAS_PTHREAD
|
||||
|
Loading…
Reference in New Issue
Block a user