]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[OPTIM] ebtree: ebmb_lookup: reduce stack usage by moving the return code out of...
authorWilly Tarreau <w@1wt.eu>
Tue, 4 Jan 2011 13:07:36 +0000 (14:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Jan 2011 13:43:58 +0000 (14:43 +0100)
commitce3d44a06ab1b552b9add745635c91c26ac7ae4f
tree327cb5082fabbe5b34d497bfdcc62271e620e0e8
parent414c4b21465f82f1438c06cb4b63806a93923f65
[OPTIM] ebtree: ebmb_lookup: reduce stack usage by moving the return code out of the loop

(from ebtree 6.0.5)

Last bugfix has introduced a de-optimization in the lookup function because
it artificially extended the scope of some local variables, which resulted in
higher stack usage and more numerous moves between stack and registers.

We can reduce that by moving the return code out of the loop, because gcc
notices that it never needs both "troot" and "node" at the same time and
can use the same register for both. Doing so has reduced the code size by
39 bytes for the lookup function alone, and has sensibly reduced the
instruction dependencies caused by data moves.
(cherry picked from commit 59be3cdb96296b65a57aff30cc203269f9a94ebe)

It should be backported to 1.4 if previous ebtree fix is backported.
ebtree/ebimtree.h
ebtree/ebmbtree.h