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

Add 'Read*' deserialize methods #199

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

agocke
Copy link
Collaborator

@agocke agocke commented Sep 9, 2024

This heavily improves performance by avoiding generic virtual dispatch in the common case of deserializing primitive types inside a struct.

After these changes, the performance difference between Serde and S.T.J is almost entirely eliminated:

| Method      | Mean       | Error   | StdDev  | Gen0   | Gen1   | Allocated |
|------------ |-----------:|--------:|--------:|-------:|-------:|----------:|
| JsonNet     | 1,032.3 ns | 2.80 ns | 2.48 ns | 0.4063 | 0.0019 |    3400 B |
| SystemText  |   617.0 ns | 3.14 ns | 2.62 ns | 0.0534 |      - |     448 B |
| SerdeJson   |   633.4 ns | 1.44 ns | 1.21 ns | 0.0963 |      - |     808 B |
| SerdeManual |   632.7 ns | 4.01 ns | 3.13 ns | 0.0963 |      - |     808 B |

This heavily improves performance by avoiding generic virtual dispatch
in the common case of deserializing primitive types inside a struct.
@agocke agocke merged commit 8633dc0 into serdedotnet:main Sep 9, 2024
1 check passed
@agocke agocke deleted the remove-most-visitors branch September 9, 2024 04:57
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.

1 participant