Use permanent atom for startup-related or frequently-used atoms, or all atoms used by bindings
Categories
(Core :: DOM: Bindings (WebIDL), task, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(13 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
bug 1848278 is going to make the permanent atom extensible from embedder, and which allows optimizing CreateInterfaceObject
and some other atom-related operation.
with speedometer 3, the 30% of the time taken by CreateInterfaceObject
is atomization, and that part can be moved to compile-time (hash and length calculation, getter/setter name calculation) + startup (remaining atomization operation into permanent atoms)
Assignee | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 2•1 year ago
|
||
Before WebIDL bindings we used to selectively optimize a lot of the DOM bindings (cf. wrapper cache, slim wrappers, quickstubs, …). The problem is that that easily leads to performance cliffs, where once a new DOM API becomes popular the performance suddenly plummets because it wasn't optimized (because it used to be rarely used). These days we try to avoid that (even though we have some mechanisms like caching of attribute values that still are opt-in).
Did we evaluate not making this opt-in, but doing it for all interfaces/properties? It would avoid having another list to keep up-to-date when adding or removing interfaces, turning on prefs, … In my experience these kind of lists get quickly out-of-date.
Assignee | ||
Comment 3•1 year ago
|
||
the problem with the current implementation is that some part of atomization (allocation, putting into table) is done at startup instead of compile-time, while it had been lazily done when the interface is first used, so this can lead to slow startup if we have so much items.
I'll check how much it increases if we put all names into permanent atoms.
maybe we need to move more parts into compile-time and possibly optimize the JSAtom
representation for this purpose.
Assignee | ||
Comment 4•1 year ago
|
||
Atomization at startup takes ~800us with 12409 entries (all WebIDL properties and interface names), that would be acceptable?
Also, the binary size increases by 360kB with the current representation.
Assignee | ||
Updated•1 year ago
|
Comment 5•1 year ago
|
||
360kB is a fair amount. Have you tried any kind of deduplication? That saved a lot of binary size for the XPIDL string constants (in xptcodegen.py).
Assignee | ||
Comment 6•1 year ago
|
||
deduplication isn't yet performed.
currently the getter name, setter name, and original property name are stored separately, but at least either getter or setter name and the original property name can be deduplicated:
get alignContent\0
^ ^
| |
| property name
getter name
or maybe the getter/setter name concatenation could be done at runtime, while still pre-calculating the hash at compile-time.
I'll look into deduplication, and also optimizing the storage
Assignee | ||
Comment 7•1 year ago
|
||
if we compress data and calculate some part at startup (accessor name etc), the essential increase from the current state would be length+hash+pointer or index, which would be ~100kB.
I'll look into the details of the trade off between the binary size and startup cost.
Assignee | ||
Comment 8•1 year ago
•
|
||
bug 1858040 solved the situation by making the accessor name calculation more lazy.
now the necessary static data is only for the property name, and the increased data is only its length and hash and pointer.
I'll update the statistics shortly.
Assignee | ||
Comment 9•1 year ago
|
||
With only property names (without the compression for length/index), the XUL file size increase is ~110kB.
There are 6782 items, and the increase matches to the length+hash+pointer which takes ~105kB.
Assignee | ||
Comment 10•1 year ago
•
|
||
Then, considering the compression, the method names and interface names are referred also from other places, for example from profiler marker code:
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"ChromeUtils", "aliveUtilityProcesses", DOM, cx,
If we're to replace string pointer with "index into large string", we need to:
- make sure the compiler's/linker's de-duplication works even between small string vs large string
- at least the large string should be have null-terminator for each item
- rewrite those other references to explicitly use the substring of the large string
otherwise we'll have duplicate text content for each method and interface name, and the binary size increases.
Assignee | ||
Comment 11•1 year ago
|
||
In order to simplify the codegen, stop using IF_* macro for well-knonw atoms
which is used by WebIDL.
Depends on D186329
Assignee | ||
Comment 12•1 year ago
|
||
Depends on D192417
Assignee | ||
Comment 13•1 year ago
|
||
Depends on D192418
Assignee | ||
Comment 14•1 year ago
|
||
Depends on D192419
Assignee | ||
Comment 15•1 year ago
|
||
Depends on D192420
Assignee | ||
Comment 16•1 year ago
|
||
Depends on D192421
Assignee | ||
Comment 17•1 year ago
|
||
Depends on D192422
Assignee | ||
Comment 18•1 year ago
|
||
Depends on D192423
Assignee | ||
Comment 19•1 year ago
|
||
Depends on D192424
Assignee | ||
Comment 20•1 year ago
|
||
Depends on D192425
Assignee | ||
Comment 21•1 year ago
|
||
Depends on D192426
Assignee | ||
Comment 22•1 year ago
|
||
Depends on D192427
Assignee | ||
Comment 23•1 year ago
|
||
Depends on D192428
Description
•