RESOLVED FIXED 79356
Little optimization in CSSParser::parseShorthand.
https://bugs.webkit.org/show_bug.cgi?id=79356
Summary Little optimization in CSSParser::parseShorthand.
Alexis Menard (darktears)
Reported 2012-02-23 04:03:11 PST
Little optimization in CSSParser::parseShorthand.
Attachments
Patch (2.53 KB, patch)
2012-02-23 04:10 PST, Alexis Menard (darktears)
no flags
Patch (2.66 KB, patch)
2012-02-23 05:01 PST, Alexis Menard (darktears)
no flags
Patch (2.56 KB, patch)
2012-02-23 06:13 PST, Alexis Menard (darktears)
no flags
Patch for landing (2.56 KB, patch)
2012-02-24 03:53 PST, Alexis Menard (darktears)
no flags
Alexis Menard (darktears)
Comment 1 2012-02-23 04:10:41 PST
Kentaro Hara
Comment 2 2012-02-23 04:28:52 PST
Comment on attachment 128455 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=128455&action=review > Source/WebCore/css/CSSParser.cpp:2682 > + bool fnd[6]= { false }; // Trust me ;) "bool fnd[6] = {false, false, false, false, false, false}" might be better (just for clarification). "bool fnd[6] = {false}" is equivalent to "bool fnd[6] = {false, 0, 0, 0, 0, 0}". This is OK because false and 0 have the same meaning in this method, but is a bit confusing. > Source/WebCore/css/CSSParser.cpp:2686 > for (int propIndex = 0; !found && propIndex < numProperties; ++propIndex) { BTW, (I am not sure how much it is important for performance but) maybe we can remove this for loop, by moving the propIndex declaration to outside while (...). Anyway you can try it in another patch.
Alexis Menard (darktears)
Comment 3 2012-02-23 05:01:17 PST
Kentaro Hara
Comment 4 2012-02-23 05:56:55 PST
Comment on attachment 128460 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=128460&action=review > Source/WebCore/css/CSSParser.cpp:-2687 > - for (int propIndex = 0; !found && propIndex < numProperties; ++propIndex) { I am sorry, I was wrong. Let us keep it as-is. ### I was thinking that we might be able to remove the for loop something like this. (The following code is wrong.) int propIndex = 0; while (m_valueList->current()) { if (propIndex >= numProperties) return false; if (parseValue(properties[propIndex], important)) { fnd[propIndex] = true; propIndex++; } } if (propIndex == numProperties) return true;
Alexis Menard (darktears)
Comment 5 2012-02-23 06:13:11 PST
Kentaro Hara
Comment 6 2012-02-23 06:14:03 PST
Comment on attachment 128470 [details] Patch Thanks for the patch!
WebKit Review Bot
Comment 7 2012-02-23 07:42:33 PST
Comment on attachment 128470 [details] Patch Rejecting attachment 128470 [details] from review queue. haraken@chromium.org does not have reviewer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py. - If you do not have reviewer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have reviewer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your reviewer rights.
Tony Chang
Comment 8 2012-02-23 10:23:30 PST
Comment on attachment 128470 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=128470&action=review > Source/WebCore/css/CSSParser.cpp:2680 > bool found = false; Can we declare found in the while loop? > Source/WebCore/css/CSSParser.cpp:2682 > + bool fnd[6]= { false, false, false, false, false, false }; // Trust me ;) I'm not sure what the comment means. I would probably just remove it. > Source/WebCore/css/CSSParser.cpp:2688 > if (!fnd[propIndex]) { > - if (parseValue(properties[propIndex], important)) > + if (parseValue(properties[propIndex], important)) { Can we merge these if statements with &&?
Kentaro Hara
Comment 9 2012-02-23 14:03:18 PST
(In reply to comment #8) > > Source/WebCore/css/CSSParser.cpp:2682 > > + bool fnd[6]= { false, false, false, false, false, false }; // Trust me ;) > > I'm not sure what the comment means. I would probably just remove it. The comment means "6 is enough size". We can update the comment to clarify that.
Alexis Menard (darktears)
Comment 10 2012-02-24 03:53:44 PST
Created attachment 128704 [details] Patch for landing
WebKit Review Bot
Comment 11 2012-02-24 06:16:37 PST
Comment on attachment 128704 [details] Patch for landing Clearing flags on attachment: 128704 Committed r108784: <http://trac.webkit.org/changeset/108784>
WebKit Review Bot
Comment 12 2012-02-24 06:16:45 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.