Bug 109630

Summary: Avoid updating timer heap when nothing changes
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, kling, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch2 kling: review+

Antti Koivisto
Reported 2013-02-12 16:40:33 PST
When the fire time of a Timer is changed we remove it from the timer heap and reinsert it. This is pretty slow. Turns out that in over 80% of cases the insertion position is the same as the original position. We can check if anything is actually going to change before doing this work.
Attachments
patch (5.24 KB, patch)
2013-02-12 16:57 PST, Antti Koivisto
no flags
patch2 (5.88 KB, patch)
2013-02-13 08:21 PST, Antti Koivisto
kling: review+
Antti Koivisto
Comment 1 2013-02-12 16:57:29 PST
WebKit Review Bot
Comment 2 2013-02-12 16:59:40 PST
Attachment 187963 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/Timer.cpp', u'Source/WebCore/platform/Timer.h']" exit_code: 1 Source/WebCore/platform/Timer.cpp:354: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Source/WebCore/platform/Timer.cpp:356: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 2 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Antti Koivisto
Comment 3 2013-02-13 08:21:32 PST
Created attachment 188085 [details] patch2 With stronger validity assertions, some cleanups.
Antti Koivisto
Comment 4 2013-02-13 11:32:48 PST
Darin Adler
Comment 5 2013-02-13 12:31:39 PST
Comment on attachment 188085 [details] patch2 View in context: https://bugs.webkit.org/attachment.cgi?id=188085&action=review > Source/WebCore/platform/Timer.h:87 > - const Vector<TimerBase*>& timerHeap() const { ASSERT(m_cachedThreadGlobalTimerHeap); return *m_cachedThreadGlobalTimerHeap; } > - Vector<TimerBase*>& timerHeap() { ASSERT(m_cachedThreadGlobalTimerHeap); return *m_cachedThreadGlobalTimerHeap; } > + Vector<TimerBase*>& timerHeap() const { ASSERT(m_cachedThreadGlobalTimerHeap); return *m_cachedThreadGlobalTimerHeap; } Why this change?
Antti Koivisto
Comment 6 2013-02-13 12:42:12 PST
(In reply to comment #5) > Why this change? Alexey pointed out in Bug 109597 that it didn't make too much sense to have both as the vector items are mutable anyway.
Note You need to log in before you can comment on or make changes to this bug.