mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #2703 - Part 1: micro-optimize purging expired preflight cache entries.
The entries in mMethods and mHeaders aren't sorted in any special way, so we can remove expired entries using UnorderedRemoveElementAt, which is faster than RemoveElementAt.
This commit is contained in:
parent
6411abd43c
commit
d678f508de
1 changed files with 8 additions and 5 deletions
|
|
@ -215,15 +215,18 @@ static bool EnsurePreflightCache()
|
|||
void
|
||||
nsPreflightCache::CacheEntry::PurgeExpired(TimeStamp now)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < mMethods.Length(); ++i) {
|
||||
for (uint32_t i = 0, len = mMethods.Length(); i < len; ++i) {
|
||||
if (now >= mMethods[i].expirationTime) {
|
||||
mMethods.RemoveElementAt(i--);
|
||||
mMethods.UnorderedRemoveElementAt(i);
|
||||
--i; // Examine the element again, if necessary.
|
||||
--len;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < mHeaders.Length(); ++i) {
|
||||
for (uint32_t i = 0, len = mHeaders.Length(); i < len; ++i) {
|
||||
if (now >= mHeaders[i].expirationTime) {
|
||||
mHeaders.RemoveElementAt(i--);
|
||||
mHeaders.UnorderedRemoveElementAt(i);
|
||||
--i; // Examine the element again, if necessary.
|
||||
--len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue