Bug 195898

Summary: Remove the inline capacity of Operands
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: JavaScriptCoreAssignee: Robin Morisset <rmorisset>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, keith_miller, mark.lam, msaboff, sbarati, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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>