Bug 89898 - Fast path for simple transform parsing
Summary: Fast path for simple transform parsing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-06-25 11:43 PDT by Antti Koivisto
Modified: 2012-06-25 12:35 PDT (History)
4 users (show)

See Also:


Attachments
patch (5.00 KB, patch)
2012-06-25 11:53 PDT, Antti Koivisto
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2012-06-25 11:43:59 PDT
When manipulating transforms using script, the transform value parsing can show up in profiles pretty heavily. We can optimize it easily by implementing a fast path that does not spin up the full CSS parser, like we already do for several other common value types.
Comment 1 Antti Koivisto 2012-06-25 11:53:59 PDT
Created attachment 149337 [details]
patch
Comment 2 Antti Koivisto 2012-06-25 11:55:50 PDT
<rdar://problem/11740369>
Comment 3 Anders Carlsson 2012-06-25 12:01:28 PDT
Comment on attachment 149337 [details]
patch

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

> Source/WebCore/css/CSSParser.cpp:1009
> +static bool parseTransformArguments(PassRefPtr<WebKitCSSTransformValue> transformValue, CharType* characters, unsigned length, unsigned start, unsigned expectedCount)
> +{

I don't think this needs to take a PassRefPtr, just a raw pointer would be fine.

> Source/WebCore/css/CSSParser.cpp:1033
> +    // Very long strings probably have multiple components which we don't handle here.
> +    if (string.length() < 13 || string.length() > 32)

I'd be nice if you explained the less than check as well.

> Source/WebCore/css/CSSParser.cpp:1038
> +    UChar c9 = toASCIILowerUnchecked(string[9]);
> +    UChar c10 = toASCIILowerUnchecked(string[10]);

Is it OK to use unchecked here?
Comment 4 Oliver Hunt 2012-06-25 12:14:41 PDT
Comment on attachment 149337 [details]
patch

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

>> Source/WebCore/css/CSSParser.cpp:1033
>> +    if (string.length() < 13 || string.length() > 32)
> 
> I'd be nice if you explained the less than check as well.

I don't like the magic numbers here.  This almost feels like something we want to auto generate.
Comment 5 Antti Koivisto 2012-06-25 12:35:23 PDT
http://trac.webkit.org/changeset/121175, with fixes
Comment 6 Antti Koivisto 2012-06-25 12:35:55 PDT
(In reply to comment #4)
> I don't like the magic numbers here.  This almost feels like something we want to auto generate.

I made them constants.