aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-05-10 14:33:00 +0200
committerBjörn Gustavsson <[email protected]>2019-05-10 14:36:44 +0200
commitc6d5af1054f8d555a69111f29b59d5485ef8e48f (patch)
treef5c5a52e70cdbb61489f724fbeee2d7c84774c2d
parent603c980080218d9997f3fdc7015bb23987fad29c (diff)
downloadotp-c6d5af1054f8d555a69111f29b59d5485ef8e48f.tar.gz
otp-c6d5af1054f8d555a69111f29b59d5485ef8e48f.tar.bz2
otp-c6d5af1054f8d555a69111f29b59d5485ef8e48f.zip
Eliminate process yield after each call to length/1
After calculating the length of a list, length/1 would accidentally bump all remaining reductions, forcing the process to yield. Correct the calculation.
-rw-r--r--erts/emulator/beam/erl_bif_guard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index c921b66a7e..09757e473b 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -306,7 +306,7 @@ Eterm erts_trapping_length_1(Process* p, Eterm* args)
* We reached the end of the list successfully. Bump reductions
* and return result.
*/
- BUMP_REDS(p, saved_max_iter / 16);
+ BUMP_REDS(p, (saved_max_iter - max_iter) / 16);
return make_small(i);
}