Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Optimize `write_metadata`. #37267
Optimize `write_metadata`. #37267
Conversation
|
Measurements for a stage1 compiler doing debug builds:
So it's a big win for regex, a moderate win for syntax-incr, a small win for html5ever, and makes little difference to the others. (I did multiple timing runs and these outcomes were consistent.) |
| .iter() | ||
| .map(to_kind) | ||
| .max() | ||
| .unwrap(); |
eddyb
Oct 19, 2016
Member
This could be written on one line, with the closure passed to it directly, and with no explicit type on the closure argument.
.max().unwrap() would come on the same line after the }) where the } is the closing bracket of the closure.
Also, you might want to do .unwrap_or(MetadataKind::None) instead of .unwrap() (cc @alexcrichton).
This could be written on one line, with the closure passed to it directly, and with no explicit type on the closure argument.
.max().unwrap() would come on the same line after the }) where the } is the closing bracket of the closure.
Also, you might want to do .unwrap_or(MetadataKind::None) instead of .unwrap() (cc @alexcrichton).
nnethercote
Oct 19, 2016
Author
Contributor
I fixed the indentation.
@alexcrichton: the specific question is this: in write_metadata, can cx.sess().crate_types be empty?
I fixed the indentation.
@alexcrichton: the specific question is this: in write_metadata, can cx.sess().crate_types be empty?
`write_metadata` currently generates metadata unnecessarily in some cases, and also compresses it unnecessarily in some cases. This commit fixes that. It speeds up three of the rustc-benchmarks by 1--4%.
6fbad7e
to
016f69f
| config::CrateTypeDylib | | ||
| config::CrateTypeProcMacro => MetadataKind::Compressed, | ||
| } | ||
| }).max().unwrap(); |
|
@bors: r=eddyb On Tuesday, October 18, 2016, Eduard-Mihai Burtescu <
|
|
|
…ddyb Optimize `write_metadata`. `write_metadata` currently generates metadata unnecessarily in some cases, and also compresses it unnecessarily in some cases. This commit fixes that. It speeds up three of the rustc-benchmarks by 1--4%. r? @eddyb, who deserves much of the credit because he (a) identified the problem from the profile data I provided in rust-lang#37086, and (b) explained to me how to fix it. Thank you, @eddyb!
write_metadatacurrently generates metadata unnecessarily in somecases, and also compresses it unnecessarily in some cases. This commit
fixes that. It speeds up three of the rustc-benchmarks by 1--4%.
r? @eddyb, who deserves much of the credit because he (a) identified the problem from the profile data I provided in #37086, and (b) explained to me how to fix it. Thank you, @eddyb!