]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: map/acl: Improve pat_ref_set() efficiency (for "set-map", "add-acl" action...
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 22 Aug 2023 14:52:47 +0000 (16:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Aug 2023 13:41:56 +0000 (15:41 +0200)
commit0844bed7d365c32e39368c9ee072ecb0572c6bde
tree6181ee27063ea26027ef2d7b8f01d69d225fdc9b
parentff9e6538590ef26fd03a75474a7e1d2405f53fdd
MEDIUM: map/acl: Improve pat_ref_set() efficiency (for "set-map", "add-acl" action perfs)

Organize reference to pattern element of map (struct pat_ref_elt) into an ebtree:
  - add an eb_root member to the map (pat_ref struct) and an ebpt_node to its
    element (pat_ref_elt struct),
  - modify the code to insert these nodes into their ebtrees each time they are
    allocated. This is done in pat_ref_append().

Note that ->head member (struct list) of map (struct pat_ref) is not removed
could have been removed. This is not the case because still necessary to dump
the map contents from the CLI in the order the map elememnts have been inserted.

This patch also modifies http_action_set_map() which is the callback at least
used by "set-map" action. The pat_ref_elt element returned by pat_ref_find_elt()
is no more ignored, but reused if not NULL by pat_ref_set() as first element to
lookup from. This latter is also modified to use the ebtree attached to the map
in place of the ->head list attached to each map element (pat_ref_elt struct).

Also modify pat_ref_find_elt() to makes it use ->eb_root map ebtree added to the
map by this patch in place of inspecting all the elements with a strcmp() call.
include/haproxy/pattern-t.h
include/haproxy/pattern.h
src/hlua.c
src/http_act.c
src/map.c
src/pattern.c