1
Fork 0

Auto merge of #109117 - oli-obk:locks, r=michaelwoerister

Avoid a few locks

We can use atomics or datastructures tuned for specific access patterns instead of locks. This may be an improvement for parallel rustc, but it's mostly a cleanup making various datastructures only usable in the way they are used right now (append data, never mutate), instead of having a general purpose lock.
This commit is contained in:
bors 2023-04-05 10:38:02 +00:00
commit 383c1d729e
17 changed files with 137 additions and 47 deletions

View file

@ -263,7 +263,8 @@ impl AllocDecodingState {
}
pub fn new(data_offsets: Vec<u32>) -> Self {
let decoding_state = vec![Lock::new(State::Empty); data_offsets.len()];
let decoding_state =
std::iter::repeat_with(|| Lock::new(State::Empty)).take(data_offsets.len()).collect();
Self { decoding_state, data_offsets }
}