RESOLVED FIXED 164603
Speed up HTMLInputElement validation
https://bugs.webkit.org/show_bug.cgi?id=164603
Summary Speed up HTMLInputElement validation
Chris Dumez
Reported 2016-11-10 11:49:53 PST
Speed up HTMLInputElement validation.
Attachments
Patch (7.56 KB, patch)
2016-11-10 19:51 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-11-10 19:51:07 PST
Radar WebKit Bug Importer
Comment 2 2016-11-10 19:57:52 PST
WebKit Commit Bot
Comment 3 2016-11-10 20:35:46 PST
Comment on attachment 294462 [details] Patch Clearing flags on attachment: 294462 Committed r208577: <http://trac.webkit.org/changeset/208577>
WebKit Commit Bot
Comment 4 2016-11-10 20:35:51 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 5 2016-11-10 20:57:01 PST
Comment on attachment 294462 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=294462&action=review > Source/WebCore/html/TextFieldInputType.cpp:397 > + return newLength < string.length() ? string.left(newLength) : string; What was the point of this change? Change log doesn’t seem to say. String::left should do this optimization, not the call site.
Chris Dumez
Comment 6 2016-11-10 21:49:01 PST
(In reply to comment #5) > Comment on attachment 294462 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=294462&action=review > > > Source/WebCore/html/TextFieldInputType.cpp:397 > > + return newLength < string.length() ? string.left(newLength) : string; > > What was the point of this change? Change log doesn’t seem to say. > String::left should do this optimization, not the call site. String::left currently does not do this optimization, neither does substring() which left() relies on. The reason I made this change is because I saw the input value sanitization spending time under String::substring (called from TextFieldInput::limitLength) even though the value length is never above the limit. I am happy to move the optimization to left() or substring() though if you think it is better. I was trying to restrict the scope of my change to HTMLInputElement. It is kind of silly to call s.left(s.length()) which is why I felt it may be better to not do this and deal with it at the call site rather than add a branch in s.left() which may slow down "sane" call sites.
Note You need to log in before you can comment on or make changes to this bug.