Open
Conversation
|
@aderyabin I think we should actually find a way to move away from creating a new instance of a type caster class because I've found it to add an enormous amount of overhead in object allocation. I started moving over to setting a EDIT: I should have mentioned, I saw this performance bottleneck while running under a profiler (which is very costly in terms of allocations), but in real world MRI examples, it's about 10% faster (2 second reduction after 10k iterations of a model with 93 attributes). |
Author
|
@film42 Could you please share benchmark script? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, typecasting works on attribute reading. There are two defects:
– every reading is every typecasting.
– if typecasted class has attributes they can't be changed, because typecasting creates a new instance every time.
I suggest typecasting on writing. It avoids from both defects