mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1554075 - Add fast path to IntervalSet::Add(IntervalSet&) when adding a size 1 set. r=jya
When playing Twitch we can spend a lot of time in TrackBuffersManager::InsertFrames() doing a TimeIntervals::operator+=(TimeIntervals): https://perfht.ml/30CekTS Twitch normally appends a range which touches the existing range. So we can fast-path this case, and avoid the expensive reallocations, CheckedInt comparisons and so forth in TimeIntervals::operator+=(TimeIntervals). Note that this fast-path is already in place in IntervalSet::operator+=(Interval), so we can just take that path when the size of the incoming IntervalSet is 1. Differential Revision: https://phabricator.services.mozilla.com/D33873 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d83c467d81
commit
6fd2c596b2
@ -300,8 +300,12 @@ class IntervalSet {
|
||||
}
|
||||
|
||||
SelfType& Add(const SelfType& aIntervals) {
|
||||
mIntervals.AppendElements(aIntervals.mIntervals);
|
||||
Normalize();
|
||||
if (aIntervals.mIntervals.Length() == 1) {
|
||||
Add(aIntervals.mIntervals[0]);
|
||||
} else {
|
||||
mIntervals.AppendElements(aIntervals.mIntervals);
|
||||
Normalize();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user