perf: reserve CSS rule map before loading from cache (#2435)
Co-authored-by: Erica Jensen <erica@mailershaven.com>
This commit is contained in:
co-authored by
Erica Jensen
parent
e142e88ce7
commit
e0253a8664
@@ -803,6 +803,9 @@ bool CssParser::loadFromCache() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Size the bucket array up front to avoid incremental rehashes while loading rules.
|
||||
rulesBySelector_.reserve(ruleCount);
|
||||
|
||||
auto hasRemainingBytes = [&file](const size_t neededBytes) -> bool {
|
||||
return static_cast<size_t>(file.available()) >= neededBytes;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user