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

Stop instantiating fix_position so many times #386

Closed
dtolnay opened this issue Nov 30, 2017 · 2 comments · Fixed by #387
Closed

Stop instantiating fix_position so many times #386

dtolnay opened this issue Nov 30, 2017 · 2 comments · Fixed by #387

Comments

@dtolnay
Copy link
Member

dtolnay commented Nov 30, 2017

The lambda here unfortunately seems to capture the V type parameter so it is instantiated lots of times. This tiny function contributes more LLVM IR than all but 5 much larger functions in #313 (comment). It should be instantiated only once per R type parameter on your deserializer.

json/src/de.rs

Line 259 in c5f30c3

Err(err) => Err(err.fix_position(|code| self.error(code))),

@Rufflewind or @Coding-Doctors would you be interested in working on this?

@Mark-Simulacrum
Copy link

If we think that the lambda shouldn't function the V type parameter and be instantiated multiple times in IR, maybe this isn't really a Serde bug and more of a rustc bug; while potentially worth fixing here, it might be better to file at rust-lang/rust instead?

@dtolnay
Copy link
Member Author

dtolnay commented Nov 30, 2017

Seems reasonable. I can't do it right now but I will put together a self-contained repro case and report it if someone else hasn't done it by then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants