Summary: | Optimize parseHTMLInteger() | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
Component: | DOM | Assignee: | Chris Dumez <cdumez> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | commit-queue, darin, esprehn+autocc, gyuyoung.kim, rniwa, sam | ||||||||
Priority: | P2 | ||||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Chris Dumez
2016-02-26 21:43:16 PST
Created attachment 272400 [details]
Patch
Comment on attachment 272400 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=272400&action=review > Source/WebCore/html/parser/HTMLParserIdioms.cpp:176 > + value = charactersToIntStrict(numberStart, position - numberStart, &ok); Can we just compute the result in the above loop instead of calling this function? We're just parsing decimal number here and we've already traversed the entire string. Created attachment 272409 [details]
Patch
Comment on attachment 272409 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=272409&action=review > Source/WebCore/html/parser/HTMLParserIdioms.cpp:178 > + int result = 0; Why don't we use unsigned here > Source/WebCore/html/parser/HTMLParserIdioms.cpp:182 > + if (result > maxMultiplier || (result == maxMultiplier && digitValue > (intMax % base) + isNegative)) So that we can simplify the second condition here? Now that I'm seeing this code for overflow check, perhaps calling charactersToIntStrict wasn't that bad... Created attachment 272418 [details]
Patch
Comment on attachment 272418 [details] Patch Clearing flags on attachment: 272418 Committed r197255: <http://trac.webkit.org/changeset/197255> All reviewed patches have been landed. Closing bug. |