Closed Bug 1687143 Opened 3 years ago Closed 3 years ago

[meta] Reduce XDR size

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

(Keywords: meta)

Attachments

(1 file, 5 obsolete files)

After stencil-mvp, the size of XDR encoded data increases ~20%, and that affects IPC performance in JSBC, and that seems to affect raptor tp6 yahoo-mail performance.

Depends on: 1687095, 1687094
Depends on: 1687093
Depends on: 1687144

Here's a testing patch that collects XDR data size, for each kind of data,
and prints them on decode
(I use decode because JSScript XDR replaces encoded data for delazifications)

the target of the stat can be specified by js::IsFileTargetOfStat in Xdr.cpp
currently set to gather raptor tp6 yahoo-mail JS files.

comparison of raptor yahoo-mail, mail_app_es6_09* JS file's XDR:

before after diff ratio
Version 22 22 0 0 %
AtomTable 594,193 1,977,500 +1,383,307 +232.8 %
ImmutableScriptData 1,982,888 1,984,138 +1,250 0 %
Scope 130,943 164,428 +33,485 +25.5 %
ScopeName 140,588 212,848 +72,260 +51.3 %
BigInt 0 18,808 +18,808 - %
Object 328,312 180,382 -147,930 -45.1 %
RegExp 320 19,320 +19,000 +5,937.5 %
GCThingData 646,028 479,194 -166,834 -25.9 %
ScriptData 343,395 765,064 +421,669 +122.7 %
ScriptExtra 428,848 490,212 +61,364 +14.3 %
SharedData 0 4,702 +4,702 - %
Module 0 0 0 - %
Source 3,071,613 3,071,613 0 0 %
Chunk 0 37,621 +37,621 - %
Total 7,667,150 9,405,852 +1,738,702 +22.6 %

also the data taken by initial vs delazifications in stencil XDR:

initial delazification
Version 22 0
AtomTable 19,065 1,958,435
ImmutableScriptData 14,369 1,969,769
Scope 27 164,401
ScopeName 16 212,832
BigInt 4 18,804
Object 4 180,378
RegExp 4 19,316
GCThingData 117,318 361,876
ScriptData 367,660 397,404
ScriptExtra 490,212 0
SharedData 1 4,701
Module 0 0
Source 3,071,613 0
Chunk 13 37,608
Total 4,080,328 5,325,524
Priority: P3 → P1
  • bug 1687093: span size data taken Scope/ScopeName/BigInt/Object/RegExp/GCThingData/ScriptData is reduced
  • bug 1688327: memberInitializer is moved from ScriptData (initial and delazification) to ScriptExtra (only initial)
2020-01-18 2020-01-26 Diff Diff (%)
Version 22 22 0 0
AtomTable 1,977,500 1,977,500 0 0
ImmutableScriptData 1,984,138 1,984,138 0 0
Scope 164,428 150,321 -14,107 -8.6 %
ScopeName 212,848 194,040 -18,808 -8.9 %
BigInt 18,808 1,729 -17,079 -90.9 %
Object 180,382 163,303 -17,079 -9.5 %
RegExp 19,320 2,241 -17,079 -88.5 %
GCThingData 479,194 465,139 -14,055 -3 %
ScriptData 765,064 626,633 -138,431 -18.1 %
ScriptExtra 490,212 551,488 +61,276 +12.4 %
SharedData 4,702 4,702 0 0
Module 0 0 0 -
Source 3,071,613 3,071,613 0 0
Chunk 37,621 23,515 -14,106 -37.5 %
Total 9,405,852 9,216,384 -189,468 -2.1 %
Attachment #9197607 - Attachment is obsolete: true
  • bug 1687428: Removed 4 bytes field (index) from ParserAtomEntry
  • bug 1688886: Directly encode ImmutableScriptData that removes redundancy

(edited: there was error in GCThingData and ScriptExtra numbers)

2020-01-26 2020-01-30 Diff Diff (%)
Version 22 22 0 0%
AtomTable 1,977,500 1,777,768 -199,732 -10.2%
ImmutableScriptData 1,984,138 1,967,736 -16,402 -0.9%
Scope 150,321 150,321 0 0
ScopeName 194,040 194,040 0 0
BigInt 1,729 1,729 0 0
Object 163,303 163,303 0 0
RegExp 2,241 2,241 0 0
GCThingData 465,139 468,701 +3,562 +0.7%
ScriptData 626,633 626,633 0 0
ScriptExtra 551,488 551,488 0 0
SharedData 4,702 4,702 0 0
Module 0 0 0 -
Source 3,071,613 3,071,613 0 0
Chunk 23,515 23,515 0 0
Total 9,216,384 9,003,812 -212,572 -2.4%
Attachment #9199235 - Attachment is obsolete: true
Attachment #9200169 - Attachment description: 0001-TEST-gather-stat-for-XDR-size.patch → testing patch to gather XDR file size stat
Attachment #9200169 - Attachment is patch: false
  • bug 1688534 : added the number of properties into XDR (increased the "Object" size)

(other difference seems to be caused by different number of delazifications, given different SharedData size)

2020-01-30 2020-02-12 Diff Diff (%)
Version 22 22 0 0.0%
AtomTable 1,777,768 1,778,008 +240 +0.0%
ImmutableScriptData 1,967,736 1,969,360 +1,624 +0.1%
Scope 150,321 150,951 +630 +0.4%
ScopeName 194,040 194,752 +712 +0.4%
BigInt 1,729 1,729 0 0.0%
Object 163,303 196,123 +32,820 +20.1%
RegExp 2,241 2,241 0 0.0%
GCThingData 468,701 469,877 +1,176 +0.3%
ScriptData 626,633 630,243 +3,610 +0.6%
ScriptExtra 551,488 554,188 +2,700 +0.5%
SharedData 4,702 4,732 +30 +0.6%
Module 0 0 0 -
Source 3,071,613 3,071,613 0 0.0%
Chunk 23,515 23,665 +150 +0.6%
Total 9,003,812 9,047,504 +43,692 +0.5%
Assignee: nobody → arai.unmht
Attachment #9200169 - Attachment is obsolete: true
Attachment #9202661 - Attachment is patch: false

also, here's self-hosted JS XDR size, on JS shell

category bytes
Version 17
AtomTable 42702
ImmutableScriptData 158636
Scope 13925
ScopeName 20024
BigInt 4
Object 2323
RegExp 4
GCThingData 18280
ScriptData 9524
ScriptExtra 17140
SharedData 481
Module 0
Source 19
Chunk 9
  • bug 1687095 : merge delazifications into initial stencil before encoding. now there's only one chunk with all data. (removed AtomTable duplication, and ScriptData duplication)
2020-02-12 2020-03-03 Diff Diff (%)
Version 22 22 0 0.0%
AtomTable 1,778,008 867,509 -910,499 -51.2%
ImmutableScriptData 1,969,360 1,969,360 0 0.0%
Scope 150,951 141,226 -9,725 -6.4%
ScopeName 194,752 194,752 0 0.0%
BigInt 1,729 4 -1,725 -99.8%
Object 196,123 192,557 -3,566 -1.8%
RegExp 2,241 516 -1,725 -77.0%
GCThingData 469,877 453,390 -16,487 -3.5%
ScriptData 630,243 307,884 -322,359 -51.1%
ScriptExtra 554,188 554,188 0 0.0%
SharedData 4,732 18,933 +14,201 +300.1%
Module 0 0 0 -
Source 3,071,613 3,071,613 0 0.0%
Chunk 23,665 6 -23,659 -100.0%
Total 9,047,504 7,771,960 -1,275,544 -14.1%

Now it's almost same as 7,667,150 bytes, that's before stencil XDR,
and this bug can be closed :)

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

(edited. the previous data was with --enable-debug)

self-hosted JS XDR data

category bytes borrowed bytes
Version 17 0
AtomTable 42,998 35,683
ImmutableScriptData 159,416 0
Scope 14,005 14,000
ScopeName 20,108 20,108
BigInt 4 0
Object 2,323 1,464
RegExp 4 0
GCThingData 18,398 18,392
ScriptData 9,564 9,560
ScriptExtra 17,212 17,208
SharedData 483 0
Module 0 0
Source 19 0
Chunk 45 0
TOTAL 284,596 116,415 (40.9%)
Attachment #9202661 - Attachment is obsolete: true

self-hosted JS XDR data, after bytecode pinning

category bytes borrowed bytes
Version 17 0
AtomTable 43,114 35,781
ImmutableScriptData 160,742 157,396
Scope 14,005 14,000
ScopeName 20,104 20,104
BigInt 4 0
Object 2,319 1,464
RegExp 4 0
GCThingData 18,324 18,320
ScriptData 9,564 9,560
ScriptExtra 17,212 17,208
SharedData 483 0
Module 0 0
Source 19 0
Chunk 49 0
TOTAL 285,960 273,833 (95.8%)
Attachment #9212993 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: