RESOLVED FIXED81070
Avoid StringImpl::getData16SlowCase() when sorting array
https://bugs.webkit.org/show_bug.cgi?id=81070
Summary Avoid StringImpl::getData16SlowCase() when sorting array
Benjamin Poulain
Reported 2012-03-13 19:19:30 PDT
When sorting a JSArray, one of the bottleneck is the conversion from StringImpl::getData16SlowCase()
Attachments
Patch (4.59 KB, patch)
2012-03-13 19:27 PDT, Benjamin Poulain
ggaren: review+
ggaren: commit-queue-
Benjamin Poulain
Comment 1 2012-03-13 19:27:27 PDT
Geoffrey Garen
Comment 2 2012-03-14 12:37:05 PDT
Comment on attachment 131773 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131773&action=review > Source/JavaScriptCore/wtf/text/StringImpl.h:782 > + if (string1 && string2) { It would be better to NULL check string1 and string2 at the head of the function, and return early if NULL, rather than NULL checking more than once in the body of the function, and indenting so much of the code. I think this would work: if (!string1) return -1; if (!string2) return string1->length(); ....
Geoffrey Garen
Comment 3 2012-03-14 12:38:11 PDT
> if (!string2) > return string1->length(); Oops! if (!string2) return string1->length() ? 1 : -1;
Benjamin Poulain
Comment 4 2012-03-14 12:44:24 PDT
> It would be better to NULL check string1 and string2 at the head of the function, and return early if NULL, rather than NULL checking more than once in the body of the function, and indenting so much of the code. I think this would work: Good point! I'll update that Thanks for the review.
Benjamin Poulain
Comment 5 2012-03-14 22:11:56 PDT
Note You need to log in before you can comment on or make changes to this bug.