diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-10-26 18:11:31 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-11-27 18:05:48 +0100 |
commit | 9c3451fdca9598772572f59bb594245e1c78137e (patch) | |
tree | b3a75d85be7cd402f948ddc4c8aadc2528b4693d /erts/emulator/beam/bif.c | |
parent | f1b572477190e2edb3daf2509388f5322882bcea (diff) | |
download | otp-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).
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r-- | erts/emulator/beam/bif.c | 4 |
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)); } |