Skip to content
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

Fix: Don't create new ContractResolver on every serialization/deserialization #609

Merged
merged 2 commits into from
Oct 16, 2020

Conversation

jploo
Copy link
Contributor

@jploo jploo commented Oct 16, 2020

What kind of change does this PR introduce?

Bug fix: #587

What is the current behavior?

For every single object that is serialized/deserialized, a new ContractResolver is created. This is a VERY expensive, reflection-heavy operation. Newtonsoft.Json is very clear that you should create and reuse a single ContractResolver.

What is the new behavior?

What might this PR break?
I believe this is low-risk.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:
If anyone has an idea of how to test this, please let me know. It is an implementation detail of a private method. As a part of this, I also fixed a couple tests that didn't work on unix-based systems.

Note that this improves performance of bulk operations by up to 40x on my Mac, iOS, and Android devices.

@dnfadmin
Copy link

dnfadmin commented Oct 16, 2020

CLA assistant check
All CLA requirements met.

@glennawatson glennawatson merged commit 7809f40 into reactiveui:main Oct 16, 2020
@glennawatson
Copy link
Contributor

Thanks for this one. I am changing all projects in this repo over to using GitHub actions and will release it once that is done.

@EmilAlipiev
Copy link

wow thanks for this fix finally. let me know once it is published any pre release or so. I will test it immediately :)

@glennawatson
Copy link
Contributor

I'm changing all the rxui builds to use GitHub actions when that is done for akavache will do a release

@EmilAlipiev
Copy link

does 7.1.1 include this fix? because i have just tested and still slow

@glennawatson
Copy link
Contributor

glennawatson commented Oct 24, 2020

It's in. https://github.com/reactiveui/Akavache/releases/tag/7.1.1

Those release notes are auto generated these days.

I am hoping to give akavache some love this week so will do some more stuff to improve bulk pushes.

GitHub
Dependencies:

d1fe8d7 build(deps): bump Xunit.SkippableFact from 1.4.8 to 1.4.13 (#590) @dependabot-preview[bot]
19458ec build(deps): bump Microsoft.NET.Test.Sdk from 16.6.1 to 16.7.0 (#597) @Depe...

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] 6.10.20 GetAllObjects function is extremely slow
4 participants