Bug 95276 - HTMLTokenizer should use the latest EfficientStrings hotness
Summary: HTMLTokenizer should use the latest EfficientStrings hotness
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 18:28 PDT by Adam Barth
Modified: 2012-09-07 11:32 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.93 KB, patch)
2012-08-28 18:29 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (2.54 KB, patch)
2012-08-28 18:39 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 18:28:15 PDT
HTMLTokenizer should use the latest EfficientStrings hotness
Comment 1 Adam Barth 2012-08-28 18:29:28 PDT
Created attachment 161111 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-08-28 18:33:51 PDT
Comment on attachment 161111 [details]
Patch

This still causes a malloc.  YOu could do this as part of the DEFINE_STATIC_LOCAL call however.
Comment 3 Adam Barth 2012-08-28 18:39:07 PDT
Created attachment 161112 [details]
Patch
Comment 4 Adam Barth 2012-08-28 18:40:01 PDT
If we're going to do this inside the DEFINE_STATIC_LOCAL, we might as well just use ASCIILiteral then since the strlen only happens once per string.
Comment 5 Benjamin Poulain 2012-08-28 18:52:55 PDT
Comment on attachment 161112 [details]
Patch

Great!

Looking at the implementation of lookAhead(), I think it would be possible to make a version that does not need static or allocations. I don't know if it is worth it or not, it depends on how hot this path is.

> Source/WebCore/ChangeLog:9
> +        Using ASCIILiteral avoids memcpying the string into the heap and
> +        therefore uses less total memory.

It does not always saves memory (due to the way the allocator works) but it is also always faster ;)
Comment 6 WebKit Review Bot 2012-09-07 11:32:33 PDT
Comment on attachment 161112 [details]
Patch

Clearing flags on attachment: 161112

Committed r127899: <http://trac.webkit.org/changeset/127899>
Comment 7 WebKit Review Bot 2012-09-07 11:32:37 PDT
All reviewed patches have been landed.  Closing bug.