shithub: mc

Download patch

ref: 9327d328746578c857ada370b61a8ad879553c69
parent: 3ec895664e76bd357845402831cf41506a0b280d
author: Ori Bernstein <ori@markovcorp.com>
date: Mon Jul 31 09:50:04 EDT 2017

Don't copy slices byte-by-byte.

--- a/lib/std/alloc.myr
+++ b/lib/std/alloc.myr
@@ -6,6 +6,7 @@
 use "types"
 use "units"
 use "bytealloc"
+use "memops"
 
 /*
 The allocator implementation here is based on Bonwick's slab allocator.
@@ -142,9 +143,7 @@
 
 	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#)
 	;;