Skip to content

Conversation

@mikhail5555
Copy link
Contributor

@mikhail5555 mikhail5555 commented May 22, 2025

For huge cidr block ranges (10.0.0.0/8) the old implementation was extremely expensive, since it added all the individual IPs to the BTreeSet which resulted both in high memory consumption and poor performance. By utilizing IpCidr, the check is nearly instant, and it works without problems with bigger cidr blocks.

Old Implementation (DNF with 10.0.0.0/8)

address parsing/parse addresses with exclusions
                        time:   [107.30 ms 107.94 ms 108.86 ms]
                        change: [+277719% +279652% +282043%] (p = 0.00 < 0.05)
                        Performance has regressed.

New Implementation (No trouble with 10.0.0.0/8)

address parsing/parse addresses with exclusions
                        time:   [37.388 µs 37.473 µs 37.565 µs]
                        change: [+32.133% +32.611% +33.098%] (p = 0.00 < 0.05)
                        Performance has regressed.

(regression is due to switching from IpNet to IpCidr to not introduce a new dependancy)

Copy link
Collaborator

@PsypherPunk PsypherPunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikhail5555, this looks good—thanks.

Currently the build's failing, specifically on the clippy checks:

cargo clippy -- --deny warnings

If you could resolve those, this should be good to go.

@mikhail5555
Copy link
Contributor Author

@mikhail5555, this looks good—thanks.

Currently the build's failing, specifically on the clippy checks:

cargo clippy -- --deny warnings

If you could resolve those, this should be good to go.

the errors I am seeing seem to be completely unrelated to any changes I have made, but if you want i can try to fix it

@mikhail5555 mikhail5555 requested a review from PsypherPunk May 31, 2025 13:07
Copy link
Collaborator

@PsypherPunk PsypherPunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @mikhail5555.

@PsypherPunk PsypherPunk merged commit 1085a72 into bee-san:master May 31, 2025
4 checks passed
@mikhail5555 mikhail5555 deleted the improve-excluded_nets-filter-performance branch June 1, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants