WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
Bug 178960
Consider using ICU's bidi algorithm instead of our custom one
https://bugs.webkit.org/show_bug.cgi?id=178960
Summary
Consider using ICU's bidi algorithm instead of our custom one
Myles C. Maxfield
Reported
2017-10-27 15:06:14 PDT
At one point in time, ICU's UBA was too slow for us to use. Since then, Firefox has switched to use ICU.
https://bugzilla.mozilla.org/show_bug.cgi?id=1308359
We should re-investigate the perf of ICU's UBA.
Attachments
WIP
(36.18 KB, patch)
2018-02-24 19:12 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(60.32 KB, patch)
2018-02-25 13:56 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(75.17 KB, patch)
2018-02-27 01:46 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(75.29 KB, patch)
2018-02-27 01:52 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(76.40 KB, patch)
2018-02-27 22:29 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(81.90 KB, patch)
2018-03-01 01:16 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(81.89 KB, patch)
2018-03-01 16:47 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(82.36 KB, patch)
2018-03-01 18:02 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(102.17 KB, patch)
2018-03-03 14:30 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(102.02 KB, patch)
2018-03-03 14:32 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(101.86 KB, patch)
2018-03-03 15:02 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(101.91 KB, patch)
2018-03-03 15:16 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(103.19 KB, patch)
2018-03-03 17:16 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(103.13 KB, patch)
2018-03-03 17:21 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(102.96 KB, patch)
2018-03-03 19:35 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(104.36 KB, patch)
2018-03-04 19:06 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(113.89 KB, patch)
2018-03-10 02:15 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(115.17 KB, patch)
2018-03-10 16:05 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
WIP
(115.17 KB, patch)
2018-03-10 18:11 PST
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Test 1
(2.37 MB, text/html)
2018-03-10 18:17 PST
,
Myles C. Maxfield
no flags
Details
Test 2
(3.58 MB, text/html)
2018-03-10 18:18 PST
,
Myles C. Maxfield
no flags
Details
Test 3
(2.17 MB, text/html)
2018-03-10 18:18 PST
,
Myles C. Maxfield
no flags
Details
Test 4
(2.19 MB, text/html)
2018-03-10 18:18 PST
,
Myles C. Maxfield
no flags
Details
Show Obsolete
(18)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-10-27 15:07:05 PDT
<
rdar://problem/35229655
>
Myles C. Maxfield
Comment 2
2018-02-24 19:12:02 PST
Created
attachment 334570
[details]
WIP
Myles C. Maxfield
Comment 3
2018-02-25 13:56:18 PST
Created
attachment 334584
[details]
WIP
Myles C. Maxfield
Comment 4
2018-02-27 01:46:45 PST
Created
attachment 334682
[details]
WIP
Myles C. Maxfield
Comment 5
2018-02-27 01:52:43 PST
Created
attachment 334683
[details]
WIP
Myles C. Maxfield
Comment 6
2018-02-27 22:29:44 PST
Created
attachment 334728
[details]
WIP
Myles C. Maxfield
Comment 7
2018-03-01 01:16:23 PST
Created
attachment 334800
[details]
WIP
Myles C. Maxfield
Comment 8
2018-03-01 16:47:44 PST
Created
attachment 334870
[details]
WIP
Myles C. Maxfield
Comment 9
2018-03-01 18:02:54 PST
Created
attachment 334875
[details]
WIP
Myles C. Maxfield
Comment 10
2018-03-01 18:55:45 PST
Comment on
attachment 334875
[details]
WIP View in context:
https://bugs.webkit.org/attachment.cgi?id=334875&action=review
> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1732 > + InlineIterator startPosition = InlineIterator(this, this, 0);
We need to figure out how to incorporate the direction property of the block.
Ryosuke Niwa
Comment 11
2018-03-01 20:06:15 PST
Please perf-test this.
Myles C. Maxfield
Comment 12
2018-03-03 14:30:22 PST
Created
attachment 334964
[details]
WIP
Myles C. Maxfield
Comment 13
2018-03-03 14:32:30 PST
Created
attachment 334965
[details]
WIP
Myles C. Maxfield
Comment 14
2018-03-03 15:02:41 PST
Created
attachment 334966
[details]
WIP
Myles C. Maxfield
Comment 15
2018-03-03 15:16:43 PST
Created
attachment 334968
[details]
WIP
Myles C. Maxfield
Comment 16
2018-03-03 15:47:36 PST
We also have to make sure that if ICU sees multiple paragraphs in the same call to ubidi_setPara(), that each paragraph gets an appropriate base direction. IIRC ICU will look for the first strong character in each paragraph, which isn't correct for us.
Myles C. Maxfield
Comment 17
2018-03-03 17:16:25 PST
Created
attachment 334970
[details]
WIP
Myles C. Maxfield
Comment 18
2018-03-03 17:21:13 PST
Created
attachment 334971
[details]
WIP
Myles C. Maxfield
Comment 19
2018-03-03 19:35:36 PST
Created
attachment 334974
[details]
WIP
Myles C. Maxfield
Comment 20
2018-03-04 19:06:02 PST
Created
attachment 334986
[details]
WIP
Myles C. Maxfield
Comment 21
2018-03-04 23:47:23 PST
I used the following script to create a test case: var target = document.getElementById("target"); var characters = ["\u05D0", "A", " ", "\u202A", "\u200E", "\u202D", "\u202B", "\u200F", "\u202E", "\u202C"]; var content = ""; for (let i = 0; i < 10000; ++i) { content = content + characters[Math.floor(Math.random() * characters.length)]; } target.textContent = content; Then, I copied/pasted the generated content into a raw .html file a bunch of times (so the test is consistent between runs). Then, I timed the runtime of layoutRunsAndFloats() using mach_absolute_time(). I opened the file 20 times using DRT, and averaged the runtimes of each time layoutRunsAndFloats() was called. I then did the same thing with this patch applied. I then did that entire sequence again once more, just to make sure. This patch reports to be a 29% progression.
Myles C. Maxfield
Comment 22
2018-03-04 23:54:22 PST
If you remove the start-up calls of layoutRunsAndFloats() (because these start-up calls will do a bunch of extra work like width measurements and font lookups, which will be cached on successive calls), this patch reports to be a 33% progression.
Myles C. Maxfield
Comment 23
2018-03-05 00:09:56 PST
Oh, the test I ran uses a single element with lots of text inside it. We should also test the case of lots of inline elements, each with only a few characters inside it.
Myles C. Maxfield
Comment 24
2018-03-05 09:14:10 PST
We should also run performance tests on content that is all one direction (like regular English or Hebrew text with spaces and punctuation).
Myles C. Maxfield
Comment 25
2018-03-05 22:33:50 PST
We should also run some performance tests on Hebrew Wikipedia
Myles C. Maxfield
Comment 26
2018-03-10 02:15:06 PST
Created
attachment 335508
[details]
WIP
Myles C. Maxfield
Comment 27
2018-03-10 02:18:30 PST
More microbenchmark performance numbers about this patch: One long element with tons of bidi control characters: ~40% progression Many elements, each having only a few characters (but overall many bidi control characters): ~20% progression Many elements, each of which holds either whitespace or strong LTR characters: about the same (within the noise)
Myles C. Maxfield
Comment 28
2018-03-10 16:05:01 PST
Created
attachment 335521
[details]
WIP
Myles C. Maxfield
Comment 29
2018-03-10 18:11:09 PST
Created
attachment 335524
[details]
WIP
Myles C. Maxfield
Comment 30
2018-03-10 18:16:55 PST
Alright, I've improved this latest patch as much as I think I can. The final microbenchmark results are: Test 1: One long element, tons of bidi control characters: 23% progression Test 2: Many elements, tons of bidi control characters: About the same (within the noise) Test 3: Many elements, no control characters, all LTR or whitespace: About the same (within the noise) Test 4: Many elements, almost all LTR or whitespace, but with (on average) one RTL character per line: 16% regression I'll attach the .html files for the tests.
Myles C. Maxfield
Comment 31
2018-03-10 18:17:52 PST
Created
attachment 335525
[details]
Test 1
Myles C. Maxfield
Comment 32
2018-03-10 18:18:04 PST
Created
attachment 335527
[details]
Test 2
Myles C. Maxfield
Comment 33
2018-03-10 18:18:20 PST
Created
attachment 335528
[details]
Test 3
Myles C. Maxfield
Comment 34
2018-03-10 18:18:34 PST
Created
attachment 335529
[details]
Test 4
Myles C. Maxfield
Comment 35
2018-03-11 00:38:10 PST
The results of the standard Page Load Test are within the noise.
Ryosuke Niwa
Comment 36
2018-03-12 11:41:05 PDT
Please also test typing & editing Hebrew & Arabic text with Arabic numerals in Latin script (1, 2, 3, etc..) on a slow phone to make sure we're not regressing the editing experience.
Myles C. Maxfield
Comment 37
2018-08-27 11:47:04 PDT
***
Bug 149170
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug