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

Update JSON.NET code to work with Unity. #2428

Merged
merged 4 commits into from
Mar 1, 2021
Merged

Update JSON.NET code to work with Unity. #2428

merged 4 commits into from
Mar 1, 2021

Conversation

pmaytak
Copy link
Contributor

@pmaytak pmaytak commented Feb 23, 2021

One of the possible solutions to #2343.

Adds a Unity preprocessor flag. Updates the JSON.NET code to use late bound serializers for Unity.

  • Make code changes
  • Run perf tests before & after change.

Perf test results
NetCore3.1 before changes:

Method Mean Error StdDev
Serialize_MsalTokenResponse_Test 7.819 μs 0.0984 μs 0.0920 μs
Deserialize_MsalTokenResponse_Test 12.899 μs 0.1522 μs 0.1423 μs
Serialize_InstanceDiscoveryResponse_Test 41.662 μs 0.0342 μs 0.0267 μs
Deserialize_InstanceDiscoveryResponse_Test 72.998 μs 0.8727 μs 0.7288 μs
Serialize_OAuth2ResponseBase_Test 2.213 μs 0.0152 μs 0.0134 μs
Deserialize_OAuth2ResponseBase_Test 3.852 μs 0.0332 μs 0.0295 μs

NetCore3.1 after changes:

Method Mean Error StdDev
Serialize_MsalTokenResponse_Test 8.112 μs 0.1621 μs 0.1991 μs
Deserialize_MsalTokenResponse_Test 13.649 μs 0.2716 μs 0.2789 μs
Serialize_InstanceDiscoveryResponse_Test 42.060 μs 0.5941 μs 0.5267 μs
Deserialize_InstanceDiscoveryResponse_Test 74.561 μs 1.1682 μs 0.9755 μs
Serialize_OAuth2ResponseBase_Test 2.240 μs 0.0425 μs 0.0398 μs
Deserialize_OAuth2ResponseBase_Test 4.008 μs 0.0425 μs 0.0398 μs

Net472 before changes:

Method Mean Error StdDev
Serialize_MsalTokenResponse_Test 4.139 μs 0.0195 μs 0.0163 μs
Deserialize_MsalTokenResponse_Test 8.706 μs 0.0936 μs 0.0830 μs
Serialize_InstanceDiscoveryResponse_Test 28.913 μs 0.3980 μs 0.3528 μs
Deserialize_InstanceDiscoveryResponse_Test 46.775 μs 0.6654 μs 0.6224 μs
Serialize_OAuth2ResponseBase_Test 1.566 μs 0.0201 μs 0.0167 μs
Deserialize_OAuth2ResponseBase_Test 2.635 μs 0.0167 μs 0.0148 μs

Net472 after changes:

Method Mean Error StdDev
Serialize_MsalTokenResponse_Test 7.405 μs 0.0803 μs 0.0712 μs
Deserialize_MsalTokenResponse_Test 13.201 μs 0.0551 μs 0.0488 μs
Serialize_InstanceDiscoveryResponse_Test 41.115 μs 0.5279 μs 0.4408 μs
Deserialize_InstanceDiscoveryResponse_Test 78.641 μs 0.4463 μs 0.4175 μs
Serialize_OAuth2ResponseBase_Test 2.341 μs 0.0135 μs 0.0120 μs
Deserialize_OAuth2ResponseBase_Test 4.302 μs 0.0077 μs 0.0068 μs

@pmaytak pmaytak changed the title Update JSON.NET code to work with Unity. [WIP] Update JSON.NET code to work with Unity. Feb 24, 2021
@pmaytak pmaytak force-pushed the pmaytak/json-net branch from 38bdde1 to c459273 Compare March 1, 2021 19:47
@pmaytak pmaytak requested a review from bgavrilMS March 1, 2021 19:48
@pmaytak pmaytak marked this pull request as ready for review March 1, 2021 19:48
@pmaytak pmaytak changed the title [WIP] Update JSON.NET code to work with Unity. Update JSON.NET code to work with Unity. Mar 1, 2021
@pmaytak pmaytak merged commit b21b945 into master Mar 1, 2021
@pmaytak pmaytak deleted the pmaytak/json-net branch March 2, 2021 07:03
@pmaytak pmaytak restored the pmaytak/json-net branch March 2, 2021 07:07
@pmaytak pmaytak deleted the pmaytak/json-net branch March 2, 2021 20:23
@trwalke trwalke mentioned this pull request Jul 28, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants