]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: add symbol range expression to further compact intervals
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 13 Feb 2025 17:56:46 +0000 (18:56 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 21 Feb 2025 22:23:10 +0000 (23:23 +0100)
commit347039f64509e77ad5f6ef52ae70950c91886f8e
treee1d9857388672f1a08dccf6ab310c2a2b1ad8288
parentb15854ef81b4c22e4660d3876384f375554887b2
src: add symbol range expression to further compact intervals

Update parser to use a new symbol range expression with smaller memory
footprint than range expression + two symbol expressions.

The evaluation step translates this into EXPR_RANGE_VALUE for interval
sets.

Note that maps or concatenations still use the less compact range
expressions representation, those require more work to use this new
symbol range expression. The parser also uses the classic range
expression if variables are used.

Testing with a 100k intervals, worst case scenario: no prefix or
singleton elements. This shows a reduction from 49.58 Mbytes to
35.47 Mbytes (-29.56% memory footprint for this case).

This follow up work to previous commits:

 91dc281a82ea ("src: rework singleton interval transformation to reduce memory consumption")
 c9ee9032b0ee ("src: add EXPR_RANGE_VALUE expression and use it")

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/expression.h
src/evaluate.c
src/expression.c
src/optimize.c
src/parser_bison.y