Bug 195898 - Remove the inline capacity of Operands
Summary: Remove the inline capacity of Operands
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-18 11:18 PDT by Robin Morisset
Modified: 2019-03-18 12:04 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.60 KB, patch)
2019-03-18 11:21 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2019-03-18 11:18:14 PDT
Operands currently has a vector with an inline capacity of 24.
I tested on JetStream2, and only 4776 functions out of 12035 (that reach the DFG tier) have 24 or fewer elements in it.
This is a major problem, because we have 5 Operands in every DFG::BasicBlock, resulting in 2688 bytes of inline capacity per basic block.
Still on JetStream 2, functions have an average of 18 BB, but those functions whose operands overflow have an average of 27 BB (so we are wasting 72kB on average when compiling them), and the largest function has 1241 BB (!), for a total of 3.3MB being wasted while it is compiled.

So I removed the inline capacity of the vector in Operands, and here are the results:
Baseline Jetstream2:
159.741
159.746
159.989
Baseline RAMification on grouped and jit tests: (end/peak/score)
89.288/89.763/89.526
90.166/90.761/90.418
89.560/90.014/89.787
After optimization Jetstream2:
159.342
161.812
162.037
After optimization RAMification:
89.147/89.644/89.395
89.102.89.585/89.343
88.953/89.536/89.2444

So it looks like a roughly 1% improvement on RAMification (at least the tests where the JIT is enabled), and more surprisingly also a 1% progression on Jetstream2 (although I have more doubts about this one considering the variability in my numbers).
I hope to land this, and get more accurate results from the bots.
Comment 1 Robin Morisset 2019-03-18 11:21:29 PDT
Created attachment 365035 [details]
Patch
Comment 2 Yusuke Suzuki 2019-03-18 11:25:15 PDT
Comment on attachment 365035 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=365035&action=review

r=me

> Source/JavaScriptCore/ChangeLog:11
> +        Still on JetStream 2, functions have an average of 18 BB, but those functions whose operands overflow have an average of 27 BB (so we are wasting 72kB on average when compiling them), and the largest function has 1241 BB (!), for a total of 3.3MB being wasted while it is compiled.

I think FTL::OSRExitDescriptor also includes Operands, and it is kept alive during the code is live :)
Comment 3 WebKit Commit Bot 2019-03-18 12:03:38 PDT
Comment on attachment 365035 [details]
Patch

Clearing flags on attachment: 365035

Committed r243088: <https://trac.webkit.org/changeset/243088>
Comment 4 WebKit Commit Bot 2019-03-18 12:03:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2019-03-18 12:04:16 PDT
<rdar://problem/48987979>