-
Notifications
You must be signed in to change notification settings - Fork 182
Draft: Speed improvements #659
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
base: master
Are you sure you want to change the base?
Conversation
@arthanson the size of this PR may have gotten a little bit out of hand. As a summary here is what's been implemented so far:
Please let me know what you think and what you'd like to possibly see as individual PR. |
@@ -109,3 +109,5 @@ | |||
"wireless.WirelessLANGroup": None, | |||
"wireless.wirelesslink": None, | |||
} | |||
|
|||
TYPE_CONTENT_MAPPER = {v: k for k, v in CONTENT_TYPE_MAPPER.items() if v is not None} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for? I don't see it used anywhere?
@@ -151,6 +151,7 @@ def __str__(self): | |||
|
|||
|
|||
class Interfaces(TraceableRecord): | |||
device = Devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this in a separate PR, it doesn't look like a speed improvement but a bug fix (if a bug fix and there isn't an issue for it, please open an issue).
@@ -53,8 +84,12 @@ def __init__(self, api, app, name, model=None): | |||
endpoint=self.name, | |||
) | |||
self._choices = None | |||
self._init_cache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only called in one place and has a function defined for it - can you just put it inline with a comment instead, not sure why we need a separate function for this?
@@ -20,6 +20,37 @@ | |||
RESERVED_KWARGS = () | |||
|
|||
|
|||
class CachedRecordRegistry: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? Split this and the one in core/app.py into two separate PR's? Although both are caching - the seem like functionally separate functionality that can be reviewed separately (and potentially backed out separately if any issues).
@srfwx , can you address/answer Arthur's concerns/questions? Otherwise, we'll need to close this out as stale work before too long. Also, please address the conflict if it's not resolved by other changes. |
Hi @jnovinger , |
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 processingget_return
now only needs to work onRecord
object and drops legacy code from Netbox 2.7_endpoint_from_url
can work with string instead of using theurlsplit
library