diff options
| author | bors <bors@rust-lang.org> | 2022-06-02 18:45:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-02 18:45:29 +0000 |
| commit | e71440575c930dcecac288b7c3536410d688b351 (patch) | |
| tree | 009840d3cb89bbf75355bfb5a04b74356c5d5db4 /compiler/rustc_mir_transform/src/coverage/debug.rs | |
| parent | 44e9516c8535c6f41f2d1c444657cd672b4ab81b (diff) | |
| parent | 72de7c41028cf0fc3d373652dc9bd9292f13a1b0 (diff) | |
| download | rust-e71440575c930dcecac288b7c3536410d688b351.tar.gz rust-e71440575c930dcecac288b7c3536410d688b351.zip | |
Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrum
Lazify `SourceFile::lines`. `SourceFile::lines` is a big part of metadata. It's stored in a compressed form (a difference list) to save disk space. Decoding it is a big fraction of compile time for very small crates/programs. This commit introduces a new type `SourceFileLines` which has a `Lines` form and a `Diffs` form. The latter is used when the metadata is first read, and it is only decoded into the `Lines` form when line data is actually needed. This avoids the decoding cost for many files, especially in `std`. It's a performance win of up to 15% for tiny crates/programs where metadata decoding is a high part of compilation costs. A `RefCell` is needed because the methods that access lines data (which can trigger decoding) take `&self` rather than `&mut self`. To allow for this, `SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather than returning the lines slice. r? `@Mark-Simulacrum`
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions
