зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1443316 - part 1 - micro-optimize purging expired preflight cache entries; r=ckerschb
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:
Родитель
e468fac775
Коммит
4e03eee08a
|
@ -187,15 +187,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче