From 9c3451fdca9598772572f59bb594245e1c78137e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 26 Oct 2012 18:11:31 +0200 Subject: erts: Use memcpy instead of while in setelement/3 * Measurements suggests that memcpy is a bit faster for small tuples and ~50% faster for large tuples. (Linux kernel-3.2.0). --- erts/emulator/beam/bif.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'erts/emulator/beam') diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 6d94632971..089d311830 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2428,9 +2428,7 @@ BIF_RETTYPE setelement_3(BIF_ALIST_3) /* copy the tuple */ resp = hp; - while (size--) { /* XXX use memcpy? */ - *hp++ = *ptr++; - } + sys_memcpy(hp, ptr, sizeof(Eterm)*size); resp[ix] = BIF_ARG_3; BIF_RET(make_tuple(resp)); } -- cgit v1.2.3