Bug 95282 - Deploy ASCIILiteral hotness throughout WebCore
Summary: Deploy ASCIILiteral hotness throughout WebCore
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Barth
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-28 21:24 PDT by Adam Barth
Modified: 2012-08-29 00:37 PDT (History)
13 users (show)

See Also:


Attachments
Patch (55.92 KB, patch)
2012-08-28 21:25 PDT, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2012-08-28 21:24:34 PDT
Deploy ASCIILiteral hotness throughout WebCore
Comment 1 Adam Barth 2012-08-28 21:25:21 PDT
Created attachment 161132 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-08-28 21:38:14 PDT
Comment on attachment 161132 [details]
Patch

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

> Source/WebCore/css/CSSPropertySourceData.cpp:91
> +    DEFINE_STATIC_LOCAL(String, emptyValue, (ASCIILiteral("e")));

Maw?

> Source/WebCore/dom/MicroDataItemList.cpp:45
>      DEFINE_STATIC_LOCAL(String, undefinedItemTypeString, (""));
> +    // FIXME: Why not just return emptyString(); ?
>      return undefinedItemTypeString;

Someone hit me with a spoon.

> Source/WebCore/editing/MarkupAccumulator.cpp:238
> -    DEFINE_STATIC_LOCAL(String, xmlnsWithColon, ("xmlns:"));
> +    DEFINE_STATIC_LOCAL(String, xmlnsWithColon, (ASCIILiteral("xmlns:")));

This seems odd.

> Source/WebCore/inspector/InspectorStyleSheet.cpp:638
> +    DEFINE_STATIC_LOCAL(String, defaultPrefix, (ASCIILiteral("    ")));

!?!

> Source/WebCore/loader/MainResourceLoader.cpp:374
> +            DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to display document because display forbidden by X-Frame-Options.\n")));

Why the \n?

> Source/WebCore/page/Page.cpp:395
>      DEFINE_STATIC_LOCAL(String, nullString, ());
> +    // FIXME: Why not just return String()?

Oh please.

> Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp:126
> -    DEFINE_STATIC_LOCAL(String, fontFace, ("Arial"));
> +    DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Arial")));

WTF?

> Source/WebCore/xml/parser/XMLTokenizer.cpp:485
> -        DEFINE_STATIC_LOCAL(String, xmlString, ("xml"));
> +        DEFINE_STATIC_LOCAL(String, xmlString, (ASCIILiteral("xml")));

XMLNames bro.

> Source/WebCore/xml/parser/XMLTreeBuilder.cpp:341
> +    DEFINE_STATIC_LOCAL(String, ampS, (ASCIILiteral("&")));
> +    DEFINE_STATIC_LOCAL(String, aposS, (ASCIILiteral("'")));
> +    DEFINE_STATIC_LOCAL(String, gtS, (ASCIILiteral(">")));
> +    DEFINE_STATIC_LOCAL(String, ltS, (ASCIILiteral("<")));
> +    DEFINE_STATIC_LOCAL(String, quotS, (ASCIILiteral("\"")));

We have the Entity technology to help you. :)
Comment 3 Adam Barth 2012-08-28 22:07:01 PDT
Comment on attachment 161132 [details]
Patch

I'll fix some of these in a followup patch.  I'm not that inclined to improve the NEWXML at the moment.
Comment 4 Benjamin Poulain 2012-08-28 22:29:56 PDT
Adam, thank you for deploying this widely, it is gonna help me a lot to track our memory.

All those static strings make me wonder if that is causing some of the memory behaviors we have. Once the StringImpl is created in a page, we can no longer give that page back to the system. :(

Maybe we should have some dense memory area just for things like these. It's something we should measure...

> > Source/WebCore/dom/MicroDataItemList.cpp:45
> >      DEFINE_STATIC_LOCAL(String, undefinedItemTypeString, (""));
> > +    // FIXME: Why not just return emptyString(); ?
> >      return undefinedItemTypeString;
> 
> Someone hit me with a spoon.

Brilliant :-D
Comment 5 Adam Barth 2012-08-28 23:13:30 PDT
> All those static strings make me wonder if that is causing some of the memory behaviors we have. Once the StringImpl is created in a page, we can no longer give that page back to the system. :(
> 
> Maybe we should have some dense memory area just for things like these. It's something we should measure...

Yeah, that makes a lot of sense.
Comment 6 Adam Barth 2012-08-29 00:37:40 PDT
Comment on attachment 161132 [details]
Patch

Clearing flags on attachment: 161132

Committed r126968: <http://trac.webkit.org/changeset/126968>
Comment 7 Adam Barth 2012-08-29 00:37:44 PDT
All reviewed patches have been landed.  Closing bug.