Title: [217055] trunk/Source/WTF
Revision
217055
Author
[email protected]
Date
2017-05-18 11:56:15 -0700 (Thu, 18 May 2017)

Log Message

AutomaticThread should wait longer before timing out
https://bugs.webkit.org/show_bug.cgi?id=172292

Reviewed by Filip Pizlo.

Increased the idle timeout from 1s => 10s.

This reduces the number of thread restarts on JetStream from
~150 => ~0. It also matches other thread pool APIs on Darwin.

Intuitively, it seems wrong for helper threads to idle exit during
hardcore benchmarking.

This patch in combination with a bmalloc fix seems to be a 1%-2% JetStream
speedup on my Mac Pro.

A nice side-benefit is that per-thread traces are easier to read.

* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (217054 => 217055)


--- trunk/Source/WTF/ChangeLog	2017-05-18 18:55:45 UTC (rev 217054)
+++ trunk/Source/WTF/ChangeLog	2017-05-18 18:56:15 UTC (rev 217055)
@@ -1,3 +1,27 @@
+2017-05-18  Geoffrey Garen  <[email protected]>
+
+        AutomaticThread should wait longer before timing out
+        https://bugs.webkit.org/show_bug.cgi?id=172292
+
+        Reviewed by Filip Pizlo.
+
+        Increased the idle timeout from 1s => 10s.
+
+        This reduces the number of thread restarts on JetStream from
+        ~150 => ~0. It also matches other thread pool APIs on Darwin.
+
+        Intuitively, it seems wrong for helper threads to idle exit during
+        hardcore benchmarking.
+
+        This patch in combination with a bmalloc fix seems to be a 1%-2% JetStream
+        speedup on my Mac Pro.
+
+        A nice side-benefit is that per-thread traces are easier to read.
+
+        * wtf/AutomaticThread.cpp:
+        (WTF::AutomaticThread::start):
+        * wtf/AutomaticThread.h:
+
 2017-05-18  Don Olmstead  <[email protected]>
 
         [Win] Remove usage of _snprintf

Modified: trunk/Source/WTF/wtf/AutomaticThread.cpp (217054 => 217055)


--- trunk/Source/WTF/wtf/AutomaticThread.cpp	2017-05-18 18:55:45 UTC (rev 217054)
+++ trunk/Source/WTF/wtf/AutomaticThread.cpp	2017-05-18 18:56:15 UTC (rev 217055)
@@ -194,10 +194,11 @@
                         if (result == PollResult::Stop)
                             return stopPermanently(locker);
                         RELEASE_ASSERT(result == PollResult::Wait);
-                        // Shut the thread down after one second.
+
+                        // Shut the thread down after a timeout.
                         m_isWaiting = true;
                         bool awokenByNotify =
-                            m_waitCondition.waitFor(*m_lock, 1_s);
+                            m_waitCondition.waitFor(*m_lock, 10_s);
                         if (verbose && !awokenByNotify && !m_isWaiting)
                             dataLog(RawPointer(this), ": waitFor timed out, but notified via m_isWaiting flag!\n");
                         if (m_isWaiting) {

Modified: trunk/Source/WTF/wtf/AutomaticThread.h (217054 => 217055)


--- trunk/Source/WTF/wtf/AutomaticThread.h	2017-05-18 18:55:45 UTC (rev 217054)
+++ trunk/Source/WTF/wtf/AutomaticThread.h	2017-05-18 18:56:15 UTC (rev 217055)
@@ -54,7 +54,7 @@
 // to this thread sitting around even when it is not needed.
 //
 // AutomaticThread is here to help you in these situations. It encapsulates a lock, a condition
-// variable, and a thread. It will automatically shut the thread down after 1 second of inactivity.
+// variable, and a thread. It will automatically shut the thread down after a timeout of inactivity.
 // You use AutomaticThread by subclassing it, and put any state that is needed between [1] and [2]
 // in the subclass.
 //
@@ -101,7 +101,7 @@
 class WTF_EXPORT_PRIVATE AutomaticThread : public ThreadSafeRefCounted<AutomaticThread> {
 public:
     // Note that if you drop all of your references to an AutomaticThread then as soon as there is a
-    // second during which it doesn't get woken up, it will simply die on its own. This is a
+    // timeout during which it doesn't get woken up, it will simply die on its own. This is a
     // permanent kind of death where the AutomaticThread object goes away, rather than the temporary
     // kind of death where AutomaticThread lives but its underlying thread dies. All you have to do
     // to prevent permanent death is keep a ref to AutomaticThread. At time of writing, every user of
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to