mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Optimize the latency of lmbench-select-file
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5b5f9cffd1
commit
0291b5dc6b
@ -49,10 +49,7 @@ impl<T> SlotVec<T> {
|
||||
///
|
||||
/// Return `None` if `idx` is out of bounds or the item is not exist.
|
||||
pub fn get(&self, idx: usize) -> Option<&T> {
|
||||
if idx >= self.slots.len() {
|
||||
return None;
|
||||
}
|
||||
self.slots[idx].as_ref()
|
||||
self.slots.get(idx)?.as_ref()
|
||||
}
|
||||
|
||||
/// Put an item into the vector.
|
||||
|
Reference in New Issue
Block a user