mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Speedup VFS::partition
The task of `partition` function is to bin the flat list of paths into disjoint filesets. Ideally, it should be incremental -- each new file should be added to a specific fileset. However, preliminary measurnments show that it is actually fast enough if we just optimize this to use a binary search instead of a linear scan.
This commit is contained in:
parent
902a9c6da7
commit
b9f3c5d585
4 changed files with 30 additions and 11 deletions
|
@ -79,6 +79,9 @@ pub enum ChangeKind {
|
|||
}
|
||||
|
||||
impl Vfs {
|
||||
pub fn len(&self) -> usize {
|
||||
self.data.len()
|
||||
}
|
||||
pub fn file_id(&self, path: &VfsPath) -> Option<FileId> {
|
||||
self.interner.get(path).filter(|&it| self.get(it).is_some())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue