Use SIMD-accelerated Latin1ness checking, inflation and deflation
Categories
(Core :: JavaScript Engine, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: hsivonen, Assigned: hsivonen)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
Bug 1490601 makes SIMD-accelerated (on tier1 architectures) operations mozilla::IsUtf16Latin1
, mozilla::LossyConvertUtf16toLatin1
, and mozilla::ConvertLatin1toUtf16
available to SpiderMonkey. Let's use them in SpiderMonkey.
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
There are a bunch of UTF-8 conversions that I didn't change in this patch. I'll file follow-ups for those.
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Comment 7•5 years ago
|
||
Thinking about it more, I think we should block this on bug 1578677. We don't want the shell and browser to diverge more than necessary - security (fuzzing) depends on it.
Assignee | ||
Comment 8•5 years ago
|
||
Can you point me to an existing example of the type of microbenchmark that I should write to show that this improves things?
Comment 9•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #8)
Can you point me to an existing example of the type of microbenchmark that I should write to show that this improves things?
Sorry for the delay. Looking at the callers, this should end up in CanStoreCharsAsLatin1
, probably worth testing also with just a few arguments:
function f() {
var t = new Date;
for (var i = 0; i < 1000000; i++) {
s = String.fromCodePoint(50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60);
}
print(new Date - t);
}
f();
Assignee | ||
Comment 10•5 years ago
|
||
Thanks. So far (I need to test a bit more), I see a perf improvement for the case you gave but a slight regression if I shorten it to 7 code points. I think I should restore the function call avoidance bits that I deleted as unnecessary after we got cross-language LTO, since it appears that for SpiderMonkey, even the one level of function calls for short strings matters.
https://hg.mozilla.org/mozilla-central/rev/a3f2cf3e1bb4#l17.69
Assignee | ||
Comment 11•5 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #7)
Thinking about it more, I think we should block this on bug 1578677. We don't want the shell and browser to diverge more than necessary - security (fuzzing) depends on it.
I filed bug 1583730 about cross-language LTO. Should it, too, be treated as a blocker for this (may affect benchmarking but should not affect fuzzing validity)?
Comment 12•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #11)
I filed bug 1583730 about cross-language LTO. Should it, too, be treated as a blocker for this (may affect benchmarking but should not affect fuzzing validity)?
Would be nice to have (also for things like Cranelift) but probably doesn't have to block...
Assignee | ||
Comment 13•5 years ago
|
||
New benchmarking build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=25f8c1da27203d4e413a13c19c0d766aa1fbd4ae
Assignee | ||
Comment 14•5 years ago
|
||
Benchmarking build with Latin1ness checking for short (len < 12) UTF-16 strings inlined:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4f1c952c00c957ebdc80fb7e3677df32ff9015d2
Assignee | ||
Comment 15•5 years ago
|
||
Benchmarking build with Latin1 <-> UTF-16 conversions inlined for short (len < 16) strings:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3b84f5fea045db2bcc271fcad97654d122278b75
Assignee | ||
Comment 16•5 years ago
|
||
Benchmarking builds with both checks as len < 16 to give the optimizer an opportunity to merge the checks:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7dce7b73b21152468992e561824459cc463bcd54
Assignee | ||
Comment 17•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 18•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #16)
Benchmarking builds with both checks as len < 16 to give the optimizer an opportunity to merge the checks:
Giving the optimizer this opportunity seemed to matter!
Assignee | ||
Comment 20•5 years ago
|
||
Try run to check that I didn't add bugs:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5e4185ff9cd06823b92909f09fffc6ba7f0af3d3
Comment 21•5 years ago
|
||
Pushed by hsivonen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/314012b65b23 Use SIMD accelerated encoding conversions in SpiderMonkey. r=jwalden https://hg.mozilla.org/integration/autoland/rev/cfe458fd3f84 addendum - Avoid function calls in ASCIIness and Latin1ness checking and conversion between Latin1 and UTF-16 for short strings. r=jandem
Comment 22•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/314012b65b23
https://hg.mozilla.org/mozilla-central/rev/cfe458fd3f84
Description
•