rust/compiler/rustc_query_impl/src
Nicholas Nethercote 0b81d7cdc6 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 `Lock` 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.
2022-06-01 10:36:39 +10:00
..
keys.rs Move lint expectation checking into a separate query (RFC 2383) 2022-05-08 14:37:14 +02:00
lib.rs Auto merge of #97239 - jhpratt:remove-crate-vis, r=joshtriplett 2022-05-21 06:38:49 +00:00
on_disk_cache.rs Lazify SourceFile::lines. 2022-06-01 10:36:39 +10:00
plumbing.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
profiling_support.rs Stop using CRATE_DEF_INDEX. 2022-04-17 12:14:42 +02:00
README.md Move the query system to rustc_query_impl. 2021-02-19 17:51:58 +01:00
values.rs Overhaul TyS and Ty. 2022-02-15 16:03:24 +11:00

For more information about how the query system works, see the rustc dev guide.