mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Make LRUCache use a linked list to reduce memmoves.
https://bugzilla.mozilla.org/show_bug.cgi?id=1398957
This commit is contained in:
parent
2cbd27c83a
commit
286888009f
5 changed files with 172 additions and 54 deletions
|
@ -68,7 +68,7 @@ use Atom;
|
|||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use bloom::StyleBloom;
|
||||
use cache::LRUCache;
|
||||
use cache::{LRUCache, Entry};
|
||||
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
||||
use dom::{TElement, SendElement};
|
||||
use matching::MatchMethods;
|
||||
|
@ -409,7 +409,7 @@ impl<E: TElement> StyleSharingTarget<E> {
|
|||
}
|
||||
|
||||
struct SharingCacheBase<Candidate> {
|
||||
entries: LRUCache<[Candidate; SHARING_CACHE_BACKING_STORE_SIZE]>,
|
||||
entries: LRUCache<Candidate, [Entry<Candidate>; SHARING_CACHE_BACKING_STORE_SIZE]>,
|
||||
}
|
||||
|
||||
impl<Candidate> Default for SharingCacheBase<Candidate> {
|
||||
|
@ -448,7 +448,7 @@ impl<E: TElement> SharingCache<E> {
|
|||
F: FnMut(&mut StyleSharingCandidate<E>) -> bool
|
||||
{
|
||||
let mut index = None;
|
||||
for (i, candidate) in self.entries.iter_mut().enumerate() {
|
||||
for (i, candidate) in self.entries.iter_mut() {
|
||||
if is_match(candidate) {
|
||||
index = Some(i);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue