Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Speed improvements #659

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

srfwx
Copy link
Contributor

@srfwx srfwx commented Dec 4, 2024

Fixes: #658 #625

Various refactoring allows for a substantial increase in performance of the Record initialization.

  • _parse_values was heavily refactored to avoid multiple similar checks and unnecessary processing
  • in turn, get_return now only needs to work on Record object and drops legacy code from Netbox 2.7
  • _endpoint_from_url can work with string instead of using the urlsplit library
  • finally caching of apps/endpoints avoid constant reinstantiation of similar objects

@srfwx srfwx changed the title Draft: Speed improvements Speed improvements Dec 6, 2024
@srfwx srfwx changed the title Speed improvements Draft: Speed improvements Dec 6, 2024
@srfwx
Copy link
Contributor Author

srfwx commented Dec 10, 2024

@arthanson the size of this PR may have gotten a little bit out of hand.
I assume you may want to break it into into smaller changes.

As a summary here is what's been implemented so far:

  • Cache of Endpoints on App
  • Cache nested Records on Endpoints
  • Adds class ValueRecord for dict that don't include an endpoint (contrary to class Record)
  • Improves speed of computation of endpoint from URL
  • Lazy computation of Record.endpoint
  • Improves value parsing performance and readability

Please let me know what you think and what you'd like to possibly see as individual PR.

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.

Speed improvements on Record init
1 participant