-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ChainExists to reduce memory footprint
ListChains was used to check if a chain exists. The method used "iptables -t TABLE -S" to list all rules and filter chains from the output. If there are massive iptables chains and rules configured, it would cause a lot of space allocated. benchmark comparison: name old time/op new time/op delta EnsureChain-48 78.2ms ± 3% 27.0ms ± 1% -65.43% (p=0.008 n=5+5) name old alloc/op new alloc/op delta EnsureChain-48 6.06MB ± 0% 0.01MB ± 0% -99.84% (p=0.016 n=4+5) name old allocs/op new allocs/op delta EnsureChain-48 4.16k ± 0% 0.04k ± 0% ~ (p=0.079 n=4+5) Signed-off-by: Quan Tian <qtian@vmware.com>
- Loading branch information
Showing
4 changed files
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters