Bug 202676

Summary: [JSC] Add fast path for String#localeCompare
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, dbates, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch mark.lam: review+

Description Yusuke Suzuki 2019-10-07 19:35:11 PDT
...
Comment 1 Yusuke Suzuki 2019-10-29 01:12:51 PDT
I've tried small improvement and gets significantly better result: if string is all-ascii, use ucol_strcollUTF8.
Comment 2 Yusuke Suzuki 2019-10-29 01:18:33 PDT
Created attachment 382164 [details]
Patch
Comment 3 Yusuke Suzuki 2019-10-29 01:42:12 PDT
Created attachment 382165 [details]
Patch
Comment 4 Yusuke Suzuki 2019-10-29 01:43:24 PDT
Created attachment 382166 [details]
Patch
Comment 5 Yusuke Suzuki 2019-10-29 13:24:03 PDT
Created attachment 382215 [details]
Patch
Comment 6 Mark Lam 2019-10-29 13:36:21 PDT
Comment on attachment 382215 [details]
Patch

r=me.  Do we already have test cases for 8bit vs 8bit, 16 bit vs 16bit, 8bit vs 16bit, and 16bit vs 8bit localeCompare?  If not, can you add this test to make sure there's no bug introduced here?  Also an API test to verify that StringView::isAllASCII() is working would also be nice.  Thanks.
Comment 7 Yusuke Suzuki 2019-10-29 13:40:13 PDT
(In reply to Mark Lam from comment #6)
> Comment on attachment 382215 [details]
> Patch
> 
> r=me.  Do we already have test cases for 8bit vs 8bit, 16 bit vs 16bit, 8bit
> vs 16bit, and 16bit vs 8bit localeCompare?  If not, can you add this test to
> make sure there's no bug introduced here?  Also an API test to verify that
> StringView::isAllASCII() is working would also be nice.  Thanks.

Oops, I forgot uploading the test.
Comment 8 Radar WebKit Bug Importer 2019-10-29 14:14:53 PDT
<rdar://problem/56720843>
Comment 9 Yusuke Suzuki 2019-10-29 14:43:38 PDT
Committed r251736: <https://trac.webkit.org/changeset/251736>