diff options
| author | bors <bors@rust-lang.org> | 2017-08-02 05:56:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-08-02 05:56:06 +0000 |
| commit | 0b5c0874b8bc35e5be57ca856994e311772ada1d (patch) | |
| tree | e10f62aafcb915097f9532dc0ddf1e91504d0865 /src/libsyntax | |
| parent | 4f3062c88e588211cb6ca109b22941f921938c3e (diff) | |
| parent | 70478ca5c83513beb91cce78ae57ade70849fca4 (diff) | |
| download | rust-0b5c0874b8bc35e5be57ca856994e311772ada1d.tar.gz rust-0b5c0874b8bc35e5be57ca856994e311772ada1d.zip | |
Auto merge of #43584 - arielb1:unused-reads, r=eddyb
Fix quadratic performance with lots of use statements This fixes 2 problems that caused quadratic performance when lots of use-statements were present. After this patch, performance is linear (and very fast) even with 1M uses. Fixes #43572. Fixes #43573. r? @eddyb
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index b3d9cf9da36..bfdcae7641d 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -561,8 +561,9 @@ impl CodeMapper for CodeMap { sp } fn ensure_filemap_source_present(&self, file_map: Rc<FileMap>) -> bool { - let src = self.file_loader.read_file(Path::new(&file_map.name)).ok(); - return file_map.add_external_src(src) + file_map.add_external_src( + || self.file_loader.read_file(Path::new(&file_map.name)).ok() + ) } } |
