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

System.Text.Json support. #101

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

System.Text.Json support. #101

wants to merge 7 commits into from

Conversation

Quahu
Copy link
Owner

@Quahu Quahu commented Aug 1, 2022

Continued from #100

Because of the overall better performance and no unnecessary LINQ allocations System.Text.Json will most likely replace Newtonsoft.Json when feature parity is achievable (.NET 7 or 8 hopefully).

System.Text.Json:

Note: performance and allocations will differ in the future as the current Disqord implementation isn't complete, so take these results with a grain of salt.
Method Job UnrollFactor Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
RestApiCallLargeBodyHighLevel DefaultJob 16 2,124.95 us 40.635 us 39.909 us 93.7500 46.8750 46.8750 461 KB
RestApiCallLargeBodyLowLevel DefaultJob 16 2,114.51 us 30.378 us 26.930 us 117.1875 58.5938 46.8750 453 KB
RestApiCallEmptyBodyHighLevel DefaultJob 16 10.91 us 0.177 us 0.236 us 1.3733 - - 4 KB
RestApiCallEmptyBodyLowLevel DefaultJob 16 10.83 us 0.093 us 0.087 us 1.3123 - - 4 KB
WebSocketLifecycleLargeGuildCreate Job-TAXHVY 1 434,255.21 us 3,697.672 us 3,277.890 us 2000.0000 1000.0000 - 120,936 KB
WebSocketLifecycleSmallGuildCreate Job-TAXHVY 1 7,077.23 us 139.918 us 181.933 us - - - 1,086 KB

Newtonsoft.Json:

Method Job UnrollFactor Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
RestApiCallLargeBodyHighLevel DefaultJob 16 2,878.45 us 29.372 us 27.474 us 218.7500 62.5000 46.8750 857 KB
RestApiCallLargeBodyLowLevel DefaultJob 16 2,960.26 us 59.181 us 95.567 us 218.7500 54.6875 46.8750 850 KB
RestApiCallEmptyBodyHighLevel DefaultJob 16 14.30 us 0.234 us 0.351 us 3.3264 - - 10 KB
RestApiCallEmptyBodyLowLevel DefaultJob 16 14.20 us 0.276 us 0.329 us 3.2349 - - 9 KB
WebSocketLifecycleLargeGuildCreate Job-SFWGZJ 1 1,425,774.56 us 23,537.066 us 27,105.321 us 54000.0000 20000.0000 3000.0000 322,344 KB
WebSocketLifecycleSmallGuildCreate Job-SFWGZJ 1 5,178.65 us 300.440 us 885.854 us - - - 1,990 KB
Benchmarked using https://github.com/kcut/institute-of-performance-research.

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.

None yet

2 participants