Avoid monomorphization bloat in Visitor::visit_{i128,u128}()#3064
Open
max-heller wants to merge 1 commit into
Open
Avoid monomorphization bloat in Visitor::visit_{i128,u128}()#3064max-heller wants to merge 1 commit into
Visitor::visit_{i128,u128}()#3064max-heller wants to merge 1 commit into
Conversation
Instantiate 128-bit integer error reporting code once per de::Error type instead of once per de::Visitor instantiation.
Contributor
Author
Contributor
|
Yes, I just suggest to cherry-pick my commit if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instantiate 128-bit integer error reporting code once per
de::Errortype instead of once perde::Visitorinstantiation.Context
I work on a (unfortunately closed source) project with a lot of large, deeply nested types deriving
Deserializefor which compilation of the monomorphizedDeserializeimpls alone takes multiple minutes usingerased-serde. I've been looking into which methods in particular are blowing up compile times and binary sizes, andVisitor::visit_{i128,u128}()popped up as an easy first step: the default implementations aren't huge (construct and return an error), but with ~7500 copies they add up.Testing
Created a sample application deserializing a complex type (
pandoc_ast::Pandoc, which has previously been used as a test case (serde-rs/json#313)). This example also useserased_serde, which has a lot of other monomorphization bloat that I'm looking into as well (though it seems harder to avoid).--releasebefore/after (7.5% decrease inllvm-lines)Unoptimized build before/after (2% decrease in
llvm-lines)