[Webkit-unassigned] [Bug 202260] New: Terrible closePath performance

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 26 01:49:49 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=202260

            Bug ID: 202260
           Summary: Terrible closePath performance
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Windows 10
            Status: NEW
          Severity: Enhancement
          Priority: P2
         Component: Canvas
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: the.mcoo at gmail.com
                CC: dino at apple.com

When using CanvasRenderingContext2D to draw complex paths we've noticed huge drop in performance when calling .closePath(). We were able to narrow down the issue to cases when there is a path containing bezier segments. When profiling, the performance of drawing a complex 2d graphics using beziers in closed paths is 30000x worse than using just line segments (5080ms vs 0.17ms). Looking at the source code of closePath method it seems like there is an overkill call to calculate bounding rects in https://github.com/WebKit/webkit/blob/master/Source/WebCore/html/canvas/CanvasPath.cpp

void CanvasPath::closePath()
{
    if (m_path.isEmpty())
        return;

    FloatRect boundRect = m_path.fastBoundingRect();    <-----   this seems to be the performance issue, the 'fast' prefix is a lie
    if (boundRect.width() || boundRect.height())
        m_path.closeSubpath();
}

To find out whether path has 'zero' size one does not need to calculate an exact bounding rect or does he?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190926/a545875f/attachment.html>


More information about the webkit-unassigned mailing list