Bug 1378537 - Store PerformanceEntry objects in AutoTArray; r=smaug
Storing PerformanceEntry objects in an AutoTArray (currently sized to
match our limit for resource timing entries) should omit some
per-entry allocations and give us a small speedup with creating
entries in tight loops.
MozReview-Commit-ID: LNgVhMn461g
--- a/dom/performance/Performance.h
+++ b/dom/performance/Performance.h
@@ -147,21 +147,24 @@ protected:
void RunNotificationObserversTask();
void QueueEntry(PerformanceEntry* aEntry);
DOMHighResTimeStamp RoundTime(double aTime) const;
nsTObserverArray<PerformanceObserver*> mObservers;
private:
- nsTArray<RefPtr<PerformanceEntry>> mUserEntries;
- nsTArray<RefPtr<PerformanceEntry>> mResourceEntries;
+ static const uint64_t kDefaultResourceTimingBufferSize = 150;
+
+ // When kDefaultResourceTimingBufferSize is increased or removed, these should
+ // be changed to use SegmentedVector
+ AutoTArray<RefPtr<PerformanceEntry>, kDefaultResourceTimingBufferSize> mUserEntries;
+ AutoTArray<RefPtr<PerformanceEntry>, kDefaultResourceTimingBufferSize> mResourceEntries;
uint64_t mResourceTimingBufferSize;
- static const uint64_t kDefaultResourceTimingBufferSize = 150;
bool mPendingNotificationObserversTask;
RefPtr<PerformanceService> mPerformanceService;
};
} // namespace dom
} // namespace mozilla