diff options
author | Phil Sutter <phil@nwl.cc> | 2020-11-20 20:01:59 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-11-23 00:12:02 +0100 |
commit | 389a0e1edc89a4048a272e569d3349b1d43bc567 (patch) | |
tree | ad4c3da174bf557c898d144e3e99a2d190d9d769 /tests/py/any/rawpayload.t | |
parent | 31f73c4c2323d2ba8634d67f37033342bc5784ed (diff) |
json: echo: Speedup seqnum_to_json()
Derek Dai reports:
"If there are a lot of command in JSON node, seqnum_to_json() will slow
down application (eg: firewalld) dramatically since it iterate whole
command list every time."
He sent a patch implementing a lookup table, but we can do better: Speed
this up by introducing a hash table to store the struct json_cmd_assoc
objects in, taking their netlink sequence number as key.
Quickly tested restoring a ruleset containing about 19k rules:
| # time ./before/nft -jeaf large_ruleset.json >/dev/null
| 4.85user 0.47system 0:05.48elapsed 97%CPU (0avgtext+0avgdata 69732maxresident)k
| 0inputs+0outputs (15major+16937minor)pagefaults 0swaps
| # time ./after/nft -jeaf large_ruleset.json >/dev/null
| 0.18user 0.44system 0:00.70elapsed 89%CPU (0avgtext+0avgdata 68484maxresident)k
| 0inputs+0outputs (15major+16645minor)pagefaults 0swaps
Bugzilla: https://bugzilla.netfilter.org/show_bug.cgi?id=1479
Reported-by: Derek Dai <daiderek@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/py/any/rawpayload.t')
0 files changed, 0 insertions, 0 deletions