aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-10-26 18:11:31 +0200
committerBjörn-Egil Dahlberg <[email protected]>2012-11-27 18:05:48 +0100
commit9c3451fdca9598772572f59bb594245e1c78137e (patch)
treeb3a75d85be7cd402f948ddc4c8aadc2528b4693d
parentf1b572477190e2edb3daf2509388f5322882bcea (diff)
downloadotp-9c3451fdca9598772572f59bb594245e1c78137e.tar.gz
otp-9c3451fdca9598772572f59bb594245e1c78137e.tar.bz2
otp-9c3451fdca9598772572f59bb594245e1c78137e.zip
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).
-rw-r--r--erts/emulator/beam/bif.c4
1 files changed, 1 insertions, 3 deletions
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));
}