Skip to content

Conversation

@shuichiro-makigaki
Copy link
Contributor

Fixes: #7365

By profiling the python interpreter, I found Prefix.get_utilization() in ipam/models/ip.py consumes a lot of time.
Especially, IPSet.add() in a loop is the biggest bottle-neck.
https://github.com/netbox-community/netbox/blob/develop/netbox/ipam/models/ip.py#L491

In my experiment, instead of IPset.add(), IPSet() constructor could reduces the execution time. IPSet() also can dedup IPs and IP ranges.

Five times quick experiments results (unit: second):

v3.0.3 fixed
37.93 9.24
38.51 9.18
39.06 10.06
37.80 9.98
38.46 10.22

@jeremystretch jeremystretch merged commit a99753f into netbox-community:develop Sep 28, 2021
@shuichiro-makigaki shuichiro-makigaki deleted the optimize-prefix-util branch September 29, 2021 07:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Showing prefix of the site that has many prefixes is slow

2 participants