-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add caching for properties in VersionClassBase #292
base: master
Are you sure you want to change the base?
Conversation
I'm really not convinced this is suitable. What makes it hard for you to cache the property yourself? |
Just a better developer experience. As a user - I was surprised to see that this is generating a query every time. If you think it's not worth it to add to the library I am fine with it - we can close the issue and PR.
|
That's a good point. However, it's a potentially breaking change so would need to be in a major release. I guess I'm surprised that you need to call |
We have a stringification logic which takes a version and tries to explain in english what changes have occured (So its kinda like a template - yes) I don't mind it being in a major release cause i do have a workaround which is elegant. |
I haven't given much thought to a major release, as I'm focusing on maintenance for now and this is the first thing that would be in it. It would be good to get tests added specifically for this feature. I'd then be happy to approve it and see if anyone else has feedback on the issue or PR. Then maybe merge it in a few weeks? If you have any other improvements (e.g. #286) maybe we can get them all into one release. |
Sure - sounds good |
Can you rebase this? Thanks! |
Cache some properties in VersionClassBase as it won't really change and can improve performance significantly by avoiding extra queries Tested this in my own application and also in a shell: >>> class A: ... @cached_property ... def abc(self): ... print("test") ... return 1 ... >>> a = A() >>> a.abc test 1 >>> a.abc 1
39b57fe
to
e93cde3
Compare
Rebased and found a minor issue - fixed it. |
Resolves #290
Improve performance in properties of VersionClassBase
So that they don't do extra sql queries and we can reuse the existing values