mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
IMPORT: ebst: use prefetching in lookup() and insert()
While the previous optimizations couldn't be preserved due to the possibility of out-of-bounds accesses, at least the prefetch is useful. A test on treebench shows that for 64k short strings, the lookup time falls from 276 to 199ns per lookup (28% savings), and the insert falls from 311 to 296ns (4.9% savings), which are pretty respectable, so let's do this. This is ebtree commit b44ea5d07dc1594d62c3a902783ed1fb133f568d.
This commit is contained in:
parent
fef4cfbd21
commit
52c6dd773d
@ -75,6 +75,10 @@ static forceinline struct ebmb_node *__ebst_lookup(struct eb_root *root, const v
|
||||
}
|
||||
node = container_of(eb_untag(troot, EB_NODE),
|
||||
struct ebmb_node, node.branches);
|
||||
|
||||
eb_prefetch(node->node.branches.b[0], 0);
|
||||
eb_prefetch(node->node.branches.b[1], 0);
|
||||
|
||||
node_bit = node->node.bit;
|
||||
|
||||
if (node_bit < 0) {
|
||||
@ -237,6 +241,10 @@ __ebst_insert(struct eb_root *root, struct ebmb_node *new)
|
||||
/* OK we're walking down this link */
|
||||
old = container_of(eb_untag(troot, EB_NODE),
|
||||
struct ebmb_node, node.branches);
|
||||
|
||||
eb_prefetch(old->node.branches.b[0], 0);
|
||||
eb_prefetch(old->node.branches.b[1], 0);
|
||||
|
||||
old_node_bit = old->node.bit;
|
||||
|
||||
/* Stop going down when we don't have common bits anymore. We
|
||||
|
Loading…
x
Reference in New Issue
Block a user