Make permanent atom set extensible by embedder
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
References
(Depends on 3 open bugs, Blocks 4 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(1 file)
In order to avoid atomization in performance-critical path in Gecko, we could:
- expose the
WellKnownAtomId
to embedding and provide API to convert it toJSAtom
andJS::PropertyKey
- also extend
JSPropertySpec
andJSFunctionSpec
so thatWellKnownAtomId
can be used there (bug 1847677)
- also extend
- provide a way to extend the permanent atom set, and allow accessing it with extended-
WellKnownAtomId
-like index, so that gecko's static atoms can be converted into JSAtom with simple pointer calculation
Assignee | ||
Comment 1•1 year ago
|
||
Here's the summary of atomization that performed during startup (5 seconds after initialzing SpiderMonkey's permanent atoms).
1.1. new profile, newtab page, parent process
NOTE: parent process uses 4 runtimes, which shares cx->staticStrings()
and cx->permanentAtoms()
, but not cx->atoms()
. which results in creating JSAtom
for same content at most 4 times.
count | unique atoms | |
---|---|---|
total atomization | 75867 | 60156 |
found in cx->staticStrings() | 7257 (9.5 %) (*1) | 187 (0.3 %) |
found in cx->permanentAtoms() | 2022 (2.6 %) (*2) | 634 (1.0 %) |
found in cx->atoms() | 979 (1.2 %) | 971 (1.6 %) |
found in cx->atoms(): exists in gecko atoms | 170 (0.2 %) (*3) | 168 (0.2 %) |
found in cx->atoms(): exists in binding properties | 392 (0.5 %) (*5) | 385 (0.6 %) |
found in cx->atoms(): exists in either | 398 (0.5 %) | 391 (0.6 %) |
new JSAtom | 65609 (86.4 %) | 59346 (98.6 %) |
new JSAtom: exists in gecko atoms | 1072 (1.4 %) (*3) | 706 (1.1 %) (*3, *4) |
new JSAtom: exists in binding properties | 5881 (7.7 %) (*5) | 3697 (6.1 %) (*5, *6) |
new JSAtom: exists in either | 6190 (8.1 %) | 3952 (6.5 %) |
- (*1) 9.5% of atomization can be replaced with cx->staticStrings() access
- (*2) 2.6% of atomization can be replaced with
WellKnownAtomId
- if all gecko atoms are added to well-known:
- (*3) 0.5% (0.2 + 1.4 - 1.1) of atomization can be skipped
- (*4) 1.1% of atomization can be performed during initialization, which helps locality, and also can skip length and hash calculation
- if all WebIDL properties are added to well-known:
- (*5) 2.1% (0.5 + 7.7 - 6.1) of atomization can be skipped
- (*6) 6.1% of atomization can be performed during initialization, which helps locality, and also can skip length and hash calculation
Exposing WellKnownAtomId
(bug 1848322) will allow (*2).
If we also expose static strings, (*1) become available.
The effect of this bug (*3 ~ *6) depends on the set of the extension, but at least using the gecko-atom seems to be simple enough (WIP patch).
If all of the above is done, this will affect 13~20% of the atomization.
1.2. new profile, newtab page, content process
count | unique atoms | |
---|---|---|
total atomization | 33172 | 15535 |
found in cx->staticStrings() | 918 (2.7 %) | 161 (1.0 %) |
found in cx->permanentAtoms() | 1126 (3.3 %) | 371 (2.3 %) |
found in cx->atoms() | 16125 (48.6 %) | 11199 (72.0 %) |
found in cx->atoms(): exists in gecko atoms | 1040 (3.1 %) | 468 (3.0 %) |
found in cx->atoms(): exists in binding properties | 3443 (10.3 %) | 2024 (13.0 %) |
found in cx->atoms(): exists in either | 3581 (10.7 %) | 2128 (13.6 %) |
new JSAtom | 15003 (45.2 %) | 15003 (96.5 %) |
new JSAtom: exists in gecko atoms | 518 (1.5 %) | 518 (3.3 %) |
new JSAtom: exists in binding properties | 2461 (7.4 %) | 2461 (15.8 %) |
new JSAtom: exists in either | 2588 (7.8 %) | 2588 (16.6 %) |
In this case, this will affect 10~24% of the atomization.
2.1. session restore, YouTube top, parent process
count | unique atoms | |
---|---|---|
total atomization | 78507 | 60432 |
found in cx->staticStrings() | 13385 (17.0 %) | 391 (0.6 %) |
found in cx->permanentAtoms() | 1555 (1.9 %) | 625 (1.0 %) |
found in cx->atoms() | 902 (1.1 %) | 897 (1.4 %) |
found in cx->atoms(): exists in gecko atoms | 168 (0.2 %) | 167 (0.2 %) |
found in cx->atoms(): exists in binding properties | 384 (0.4 %) | 379 (0.6 %) |
found in cx->atoms(): exists in either | 390 (0.4 %) | 385 (0.6 %) |
new JSAtom | 62665 (79.8 %) | 59419 (98.3 %) |
new JSAtom: exists in gecko atoms | 924 (1.1 %) | 710 (1.1 %) |
new JSAtom: exists in binding properties | 4864 (6.1 %) | 3729 (6.1 %) |
new JSAtom: exists in either | 5147 (6.5 %) | 3980 (6.5 %) |
In this case, this will affect 20~25% of the atomization.
2.2. session restore, YouTube top, content process
count | unique atoms | |
---|---|---|
total atomization | 91253 | 87052 |
found in cx->staticStrings() | 902 (0.9 %) | 186 (0.2 %) |
found in cx->permanentAtoms() | 962 (1.0 %) | 554 (0.6 %) |
found in cx->atoms() | 3077 (3.3 %) | 2374 (2.7 %) |
found in cx->atoms(): exists in gecko atoms | 505 (0.5 %) | 345 (0.3 %) |
found in cx->atoms(): exists in binding properties | 1346 (1.4 %) | 959 (1.1 %) |
found in cx->atoms(): exists in either | 1405 (1.5 %) | 1016 (1.1 %) |
new JSAtom | 86312 (94.5 %) | 86312 (99.1 %) |
new JSAtom: exists in gecko atoms | 822 (0.9 %) | 822 (0.9 %) |
new JSAtom: exists in binding properties | 3451 (3.7 %) | 3451 (3.9 %) |
new JSAtom: exists in either | 3795 (4.1 %) | 3795 (4.3 %) |
In this case, this will affect 3~7% of the atomization.
Assignee | ||
Comment 2•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•