diff options
author | David Mitchell <davem@iabyn.com> | 2016-08-17 12:06:27 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-08-17 13:39:24 +0100 |
commit | f4d8be8b395cdacf05f8c461fb7e9ce0366ff56f (patch) | |
tree | 87ffdc5f105230dcea6446fcb2ea3da5852c0ee7 /Porting/deparse-skips.txt | |
parent | 11b62bc4c2460b23807b5c84c6e8b463068cf886 (diff) | |
download | perl-f4d8be8b395cdacf05f8c461fb7e9ce0366ff56f.tar.gz |
av_fetch(): use less branches.
The code that handles negative array indexes and out-of-bounds
negative indices used to require:
2 conditions for a +ve index
3 conditions for a -ve index
After this commit, for the common case where the index is in bounds,
it requires a single condition regardless of sign. For the less common
case of out-of-bounds, it requires 2 conditions.
Also, the one condition is more branch-predict friendly - it's whether
the index is in bounds or not. Previously the first test was whether
key < 0, and in code that does mixed signs, such as $a[0] + $a[-1],
branch prediction could be tricky.
It achieves this at the expense of a more complex expression for the key.
Diffstat (limited to 'Porting/deparse-skips.txt')
0 files changed, 0 insertions, 0 deletions