[webkit-changes] [WebKit/WebKit] ab0f8a: [WTF] Avoid MonotonicTime::now / WallTime::now cal...

Yusuke Suzuki noreply at github.com
Sun Apr 30 01:21:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ab0f8a142a9441282025b9a77c4c37cf453a794b
      https://github.com/WebKit/WebKit/commit/ab0f8a142a9441282025b9a77c4c37cf453a794b
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-04-30 (Sun, 30 Apr 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/WaiterListManager.cpp
    M Source/JavaScriptCore/runtime/Watchdog.cpp
    M Source/WTF/wtf/ApproximateTime.cpp
    M Source/WTF/wtf/Condition.h
    M Source/WTF/wtf/GenericTimeMixin.h
    M Source/WTF/wtf/MessageQueue.h
    M Source/WTF/wtf/MonotonicTime.cpp
    M Source/WTF/wtf/ParkingLot.cpp
    M Source/WTF/wtf/WTFSemaphore.h
    M Source/WTF/wtf/WallTime.cpp
    M Source/WTF/wtf/posix/ThreadingPOSIX.cpp
    M Source/WTF/wtf/threads/BinarySemaphore.h
    M Source/WTF/wtf/win/RunLoopWin.cpp
    M Source/WTF/wtf/win/ThreadingWin.cpp
    M Source/WebCore/platform/graphics/cocoa/WebProcessGraphicsContextGLCocoa.mm

  Log Message:
  -----------
  [WTF] Avoid MonotonicTime::now / WallTime::now calls if relative seconds are infinity
https://bugs.webkit.org/show_bug.cgi?id=256143
rdar://108706987

Reviewed by Mark Lam.

This is micro-optimization. If relative seconds from now is infinity, we should not call MonotonicTime::now() / WallTime::now()
to compute the result. They involve system calls, and it is common that relative seconds are infinity (for example, just waiting
Condition without timeout is infinity).

* Source/WTF/wtf/ApproximateTime.cpp:
(WTF::ApproximateTime::approximateWallTime const):
(WTF::ApproximateTime::approximateMonotonicTime const):
* Source/WTF/wtf/Condition.h:
* Source/WTF/wtf/GenericTimeMixin.h:
(WTF::GenericTimeMixin::timePointFromNow):
* Source/WTF/wtf/MessageQueue.h:
(WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout):
* Source/WTF/wtf/MonotonicTime.cpp:
(WTF::MonotonicTime::approximateWallTime const):
* Source/WTF/wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
* Source/WTF/wtf/WTFSemaphore.h:
* Source/WTF/wtf/WallTime.cpp:
(WTF::WallTime::approximateMonotonicTime const):
* Source/WTF/wtf/threads/BinarySemaphore.h:
* Source/WTF/wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):

Canonical link: https://commits.webkit.org/263538@main




More information about the webkit-changes mailing list