Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3e7f2c1bc01db4255c2de428d4b5d04ab054df86
      
https://github.com/WebKit/WebKit/commit/3e7f2c1bc01db4255c2de428d4b5d04ab054df86
  Author: Yusuke Suzuki <[email protected]>
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext.h

  Log Message:
  -----------
  REGRESSION(274164@main): Do not consult against Document's WeakHashSet for 
every Canvas ops
https://bugs.webkit.org/show_bug.cgi?id=269867
rdar://123400342

Reviewed by Ryosuke Niwa.

274164@main introduced addCanvasNeedingPreparationForDisplayOrFlush and 
removeCanvasNeedingPreparationForDisplayOrFlush, which consult against 
Document's WeakHashSet
for every Canvas operation. Because each Canvas operation is very tiny, Canvas 
operations are called super frequently, and any kind of performance regression 
on each
call can be exhibited as visible performance regression. WeakHashSet querying 
is costly, and Document is super large so frequent cache miss happens.
Instead, we store a bool flag to CanvasRenderingContext, which says whether it 
is registered in Document's WeakHashSet. And avoid this costly operation once 
it gets registered.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::prepareCanvasesForDisplayOrFlushIfNeeded):
(WebCore::Document::addCanvasNeedingPreparationForDisplayOrFlush):
(WebCore::Document::removeCanvasNeedingPreparationForDisplayOrFlush):
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::addCanvasNeedingPreparationForDisplayOrFlush):
(WebCore::CanvasBase::removeCanvasNeedingPreparationForDisplayOrFlush):
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::didMoveToNewDocument):
* Source/WebCore/html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::setIsToPrepare):
(WebCore::CanvasRenderingContext::isInPreparationForDisplayOrFlush const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to