Bug 177028

Summary: Avoid calling String::format() in PlatformCAFilters::setFiltersOnLayer()
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: AnimationsAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, sam, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 30342    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Said Abou-Hallawa 2017-09-15 16:53:00 PDT
From instrumenting the MotionMark Focus test with fixed complexity, this function alone takes 2% of the execution time.
Comment 1 Said Abou-Hallawa 2017-09-15 16:55:48 PDT
Created attachment 320969 [details]
Patch
Comment 2 Tim Horton 2017-09-15 17:10:49 PDT
Comment on attachment 320969 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=320969&action=review

> Source/WebCore/ChangeLog:8
> +        String::fromat() is a bigger hammer for what we need to do in this function.

FROMAT

> Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:71
> +    static NeverDestroyed<String> filterNamePrefix ="filter_";

There's a missing space after the =. Also isn't there a way to make this more efficient b/c it comes from a literal (something like ASCIILiteral? or does that just happen magically? I don't know. Look around.)
Comment 3 Said Abou-Hallawa 2017-09-15 17:26:50 PDT
Created attachment 320976 [details]
Patch
Comment 4 Said Abou-Hallawa 2017-09-15 18:44:38 PDT
Created attachment 320984 [details]
Patch
Comment 5 WebKit Commit Bot 2017-09-15 19:26:48 PDT
Comment on attachment 320984 [details]
Patch

Clearing flags on attachment: 320984

Committed r222125: <http://trac.webkit.org/changeset/222125>
Comment 6 WebKit Commit Bot 2017-09-15 19:26:49 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Sam Weinig 2017-09-17 15:18:38 PDT
Comment on attachment 320984 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=320984&action=review

> Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:74
> +        String filterName = filterNamePrefix.get() + String::number(i);

For the future, this could be make more efficient by doing:

#include <wtf/text/StringConcatenate.h>
#include <wtf/text/StringConcatenateNumbers.h>

auto filterName = makeString("filter_", i);
Comment 8 Radar WebKit Bug Importer 2017-09-27 12:41:37 PDT
<rdar://problem/34693768>