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 serialization benchmark #99

Merged
merged 1 commit into from
Dec 10, 2023
Merged

Add serialization benchmark #99

merged 1 commit into from
Dec 10, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 10, 2023

0.3.31:

test serialize_twitter_erased            ... bench:     802,487 ns/iter (+/- 11,307)
test serialize_twitter_monomorphized     ... bench:     474,801 ns/iter (+/- 7,682)
test twitter_to_json_value_erased        ... bench:   2,566,877 ns/iter (+/- 20,966)
test twitter_to_json_value_monomorphized ... bench:   1,830,965 ns/iter (+/- 28,052)

0.4.0-rc.1:

test serialize_twitter_erased            ... bench:     621,762 ns/iter (+/- 5,584)
test serialize_twitter_monomorphized     ... bench:     468,732 ns/iter (+/- 4,154)
test twitter_to_json_value_erased        ... bench:   2,149,379 ns/iter (+/- 16,055)
test twitter_to_json_value_monomorphized ... bench:   1,854,377 ns/iter (+/- 18,861)

The overhead for erased-serde vs monomorphized serde_json is 40%–69% in 0.3, and 16%–31% in 0.4. So the serializer refactor in 0.4 reduces overhead by over 2×.

@dtolnay dtolnay merged commit 2e48977 into master Dec 10, 2023
18 of 19 checks passed
@dtolnay dtolnay deleted the bench branch December 10, 2023 02:53
Repository owner locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant