summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-07-31 13:50:04 -0700
committerOri Bernstein <ori@markovcorp.com>2017-07-31 13:50:04 -0700
commit9327d328746578c857ada370b61a8ad879553c69 (patch)
tree2748106cc36dd98589a88b32cf0ecee7599465ed
parent3ec895664e76bd357845402831cf41506a0b280d (diff)
downloadmc-9327d328746578c857ada370b61a8ad879553c69.tar.gz
Don't copy slices byte-by-byte.
-rw-r--r--lib/std/alloc.myr5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/std/alloc.myr b/lib/std/alloc.myr
index aefa179..ac32ce5 100644
--- a/lib/std/alloc.myr
+++ b/lib/std/alloc.myr
@@ -6,6 +6,7 @@ use "threadhooks"
use "types"
use "units"
use "bytealloc"
+use "memops"
/*
The allocator implementation here is based on Bonwick's slab allocator.
@@ -142,9 +143,7 @@ generic slgrow = {sl : @a[:]#, len
new = slalloc(cap)
n = min(len, sl#.len)
- for var i = 0; i < n; i++
- new[i] = sl#[i]
- ;;
+ memblit((new : byte#), (sl# : byte#), n * sizeof(@a))
if sl#.len > 0
slfree(sl#)
;;