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
Performance of Container class #869
Comments
I spent a lot of time tweaking this class so I am no so keen on changing it. I also tried deriving it from OrderedDict rather than implementing it myself and it didnt work as expected. So no, I am not accepting this. But thanks for trying. |
Mhm. You might note that regular dicts are ordered now (from 3.6 if I'm not mistaken). |
I think it is a good idea to finally leverage the ordered dict implementation in Py3. Thank you for bringing this up. I will redo your work later (at some point). |
About dicts: you got it wrong. Since 3.6 its "an implementation detail" (OrderedDict is needed for a guarantee across pythons). Since 3.7 its a guarantee for ordinary dicts. Construct to day supports 3.6. |
I am leaving this open as a remainder of what to do. Please do not close. |
I am reopening (again) this ticket and giving it real thought. Would you like to PR it? Otherwise I will do it myself. |
Well, I'm still using the patch from this |
What do you mean by "this PR"? This is NOT a pull request, its an ordinary issue. You pasted a diff. |
Ah nevermind. After little help from uncle Google I figured how to apply your patch. I will take it from here. Thanks again. |
Your diff was not appliable to my working directory. I had to manually rework your patch. Next time, please do a proper PR. Merged and tested. |
The patch was against 2.9.45, I mentioned that. Anyway, I don't think there will be a next time ;) |
Oh you mean the library is so spit and polish that there is no need for more patches? :P |
Exactly! Especially the "polish" part. |
Yeah, that joke is as old as me. Funny. |
Hi,
Disclaimer: I'm using python 3.7.
I've noticed that Container class (esp.
__set*__
methods) introduce a performance penalty. Initial profiling suggests it's about 2x:578010 function calls (558956 primitive calls) in 0.272 seconds
vs
231299 function calls (212245 primitive calls) in 0.105 seconds
To get these results, I simplified the Container class like this (and updated usages in the code):
Would you be interested in such a patch? It broke one unit test, but rather trivially:
The text was updated successfully, but these errors were encountered: