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.
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
Serializer will now ignore: indexer properties, and properties with their name listed in a JsonIgnore above the declaring class #299
base: main
Are you sure you want to change the base?
Serializer will now ignore: indexer properties, and properties with their name listed in a JsonIgnore above the declaring class #299
Changes from 2 commits
9c5c5c6
51f3c9b
7bc39ab
049612c
453f180
e3f541c
37207a7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
missing enter before the line
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.
and why setting parameters to null?
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.
My thought was, this ParameterInfo[] could take up memory needed for other things, and if it's set to null before the end of the function, the garbage collector might get it sooner. TBH, I don't know enough about how the garbage collector works. If my assumption was untrue, then my bad. Thinking about it more, I guess the function would at least try to finish in a time slice if it can, and then the parameters variable wouldn't exist anymore anyway.
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.
While benchmarking, removed the call to GetParameters() altogether and replaced with method.Name == "get_Item". Much better performance with the same effect!
For example, ComplexArrayObject benchmark got a mean of 446 ms with GetParameters(), and 382ms with string check.
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.
I love when optimizations are coming all along with this benchmark tool and some good thinking! Great work on this!
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.
For performance reasons, please add a new option in the sterilizer so you call this only if the ignore option is on. The cost is VERY high in terms of performances when this is calls every time.
Also, please cache this because as you place it on the class level, you should call it only once, not for every property.
By having those 2 things implemented, you can have a decent performance.
And please run the performance tool without your code and with your code, so we can compare.
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.
that should be cashed for a specific class