Bug 87039 - GC allocation trigger should be tuned to system RAM size
Summary: GC allocation trigger should be tuned to system RAM size
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-21 12:51 PDT by Geoffrey Garen
Modified: 2012-05-22 13:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch (20.47 KB, patch)
2012-05-21 12:57 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (20.52 KB, patch)
2012-05-21 17:19 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.01 KB, patch)
2012-05-21 17:51 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.05 KB, patch)
2012-05-21 18:09 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.05 KB, patch)
2012-05-21 22:51 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.06 KB, patch)
2012-05-21 22:54 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.01 KB, patch)
2012-05-22 00:08 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (22.23 KB, patch)
2012-05-22 10:16 PDT, Geoffrey Garen
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2012-05-21 12:51:51 PDT
GC allocation trigger should be tuned to system RAM
Comment 1 Geoffrey Garen 2012-05-21 12:57:09 PDT
Created attachment 143080 [details]
Patch
Comment 2 Geoffrey Garen 2012-05-21 12:57:37 PDT
~> cat 32mb_2x_report.txt 
Benchmark report for SunSpider, V8, V8Real, Kraken, JSBench, JSRegress, and DSP on admins-Mac-Pro (MacPro5,1).

VMs tested:
"BASE" at /Volumes/Big/ggaren/baseline-webkit/WebKitBuild/Release/DumpRenderTree (r117524)
"PATCH" at /Volumes/Big/ggaren/webkit/WebKitBuild/Release/DumpRenderTree (r117524)

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. Emitted a call to gc() between sample
measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the jsc-specific preciseTime() function to
get microsecond-level timing. Reporting benchmark execution times with 95% confidence intervals in milliseconds.

                                                     BASE                     PATCH                                       
SunSpider:
   3d-cube                                      8.8941+-0.1494            8.8636+-0.1431        
   3d-morph                                     8.6683+-0.0933            8.5974+-0.0502        
   3d-raytrace                                 11.8269+-0.5472     ?     11.9260+-0.5203        ?
   access-binary-trees                          2.1292+-0.0343     ?      2.2526+-0.2923        ? might be 1.0579x slower
   access-fannkuch                              8.6984+-0.0413     ?      8.7087+-0.0588        ?
   access-nbody                                 4.5317+-0.0756     ?      4.5508+-0.0841        ?
   access-nsieve                                4.2925+-0.0497            4.2407+-0.0343          might be 1.0122x faster
   bitops-3bit-bits-in-byte                     1.6538+-0.0201            1.6388+-0.0171        
   bitops-bits-in-byte                          6.2694+-0.0583            6.2563+-0.0615        
   bitops-bitwise-and                           3.9500+-0.0110     ?      3.9664+-0.0302        ?
   bitops-nsieve-bits                           3.8138+-0.0123     ?      3.8339+-0.0270        ?
   controlflow-recursive                        2.8328+-0.0219     ?      2.8393+-0.0256        ?
   crypto-aes                                   9.2119+-0.1793            9.1912+-0.1895        
   crypto-md5                                   3.9639+-0.0915            3.9457+-0.0896        
   crypto-sha1                                  3.2359+-0.0738            3.2321+-0.0599        
   date-format-tofte                           15.3280+-1.4694           15.2775+-1.3986        
   date-format-xparb                           12.9319+-0.9340           12.4089+-0.8364          might be 1.0421x faster
   math-cordic                                  5.0354+-0.1118            5.0257+-0.1147        
   math-partial-sums                           10.6281+-0.0893           10.5541+-0.0589        
   math-spectral-norm                           3.4080+-0.0687            3.3910+-0.0528        
   regexp-dna                                  11.5131+-0.1319           11.4066+-0.1042        
   string-base64                                6.4778+-0.7862     ?      6.5431+-0.7522        ? might be 1.0101x slower
   string-fasta                                 9.5047+-0.4717            9.4673+-0.4634        
   string-tagcloud                             15.4579+-0.4264           15.4370+-0.4386        
   string-unpack-code                          25.7212+-0.9442           25.6505+-0.8775        
   string-validate-input                        9.6673+-0.6664            9.6198+-0.6672        

   <arithmetic> *                               8.0633+-0.1179            8.0317+-0.1152          might be 1.0039x faster
   <geometric>                                  6.5415+-0.0386            6.5313+-0.0554          might be 1.0016x faster
   <harmonic>                                   5.2563+-0.0137     ?      5.2599+-0.0433        ? might be 1.0007x slower

                                                     BASE                     PATCH                                       
V8:
   crypto                                      86.9521+-0.5854     ?     86.9597+-0.7046        ?
   deltablue                                  181.1783+-2.6885          180.0670+-2.3770        
   earley-boyer                               106.8531+-0.4001     ^    101.7632+-1.3013        ^ definitely 1.0500x faster
   raytrace                                    62.6496+-0.6298     ^     60.7331+-0.7870        ^ definitely 1.0316x faster
   regexp                                     107.0115+-0.6270     ?    108.1183+-0.6245        ? might be 1.0103x slower
   richards                                   167.4984+-4.0645          165.5703+-3.0512          might be 1.0116x faster
   splay                                      138.5698+-10.0919         124.0909+-10.3125         might be 1.1167x faster

   <arithmetic>                               121.5304+-1.3474     ^    118.1861+-1.0375        ^ definitely 1.0283x faster
   <geometric> *                              114.6376+-1.0229     ^    111.4174+-0.9473        ^ definitely 1.0289x faster
   <harmonic>                                 107.7348+-0.6623     ^    104.7347+-0.8084        ^ definitely 1.0286x faster

                                                     BASE                     PATCH                                       
V8Real:
   encrypt                                     0.49169+-0.00053    ^     0.48928+-0.00046       ^ definitely 1.0049x faster
   decrypt                                     8.57254+-0.01124          8.56885+-0.01264       
   deltablue                          x2       1.09060+-0.00943          1.08266+-0.01640       
   earley                                      3.50025+-0.03544          3.45556+-0.03352         might be 1.0129x faster
   boyer                                      18.06434+-0.08127    ^    16.72847+-0.13415       ^ definitely 1.0799x faster
   raytrace                           x2       7.99603+-0.13941          7.92574+-0.10814       
   regexp                             x2      31.12863+-0.15945    ^    30.58857+-0.10219       ^ definitely 1.0177x faster
   richards                           x2       0.43927+-0.00474          0.43835+-0.00383       
   splay                              x2       1.05560+-0.01627          1.05535+-0.01415       

   <arithmetic>                                8.14636+-0.03777    ^     7.95882+-0.02451       ^ definitely 1.0236x faster
   <geometric> *                               2.97308+-0.01216    ^     2.93787+-0.01247       ^ definitely 1.0120x faster
   <harmonic>                                  1.26243+-0.00570          1.25739+-0.00728         might be 1.0040x faster

                                                     BASE                     PATCH                                       
Kraken:
   ai-astar                                    948.255+-2.490            945.834+-2.084         
   audio-beat-detection                        233.030+-1.802            232.801+-1.644         
   audio-dft                                   336.217+-0.505      ?     336.707+-0.730         ?
   audio-fft                                   137.931+-0.244            137.356+-0.514         
   audio-oscillator                            370.937+-2.045      ?     372.775+-2.519         ?
   imaging-darkroom                            328.645+-2.116      ?     328.834+-2.179         ?
   imaging-desaturate                          252.515+-0.189      ^     252.142+-0.059         ^ definitely 1.0015x faster
   imaging-gaussian-blur                       525.784+-0.771            525.565+-0.498         
   json-parse-financial                         76.493+-0.280      ^      75.178+-0.267         ^ definitely 1.0175x faster
   json-stringify-tinderbox                     96.903+-0.387             96.843+-0.561         
   stanford-crypto-aes                         102.272+-0.650            101.105+-0.630           might be 1.0115x faster
   stanford-crypto-ccm                         108.876+-0.513      ?     109.114+-0.653         ?
   stanford-crypto-pbkdf2                      222.823+-0.946      ^     220.772+-0.861         ^ definitely 1.0093x faster
   stanford-crypto-sha256-iterative            108.472+-0.225      ?     108.650+-0.196         ?

   <arithmetic> *                              274.940+-0.360            274.548+-0.359           might be 1.0014x faster
   <geometric>                                 210.293+-0.242      ^     209.730+-0.274         ^ definitely 1.0027x faster
   <harmonic>                                  168.196+-0.262      ^     167.432+-0.256         ^ definitely 1.0046x faster

                                                     BASE                     PATCH                                       
JSBench:
   amazon                                      20.6667+-0.3128     ?     20.8333+-0.2473        ?
   facebook                                    77.5833+-1.6133     ?     78.0833+-1.9245        ?
   google                                     112.2500+-4.5019          109.0000+-1.6255          might be 1.0298x faster
   twitter                                     59.7500+-0.2874           59.3333+-0.4138        
   yahoo                                       25.5000+-0.3318     ?     25.9167+-0.1834        ? might be 1.0163x slower

   <arithmetic> *                              59.1500+-0.8872           58.6333+-0.4961          might be 1.0088x faster
   <geometric>                                 48.6889+-0.4728           48.6453+-0.3249          might be 1.0009x faster
   <harmonic>                                  39.6202+-0.3632     ?     39.8562+-0.2740        ? might be 1.0060x slower

                                                     BASE                     PATCH                                       
JSRegress:
   adapt-to-double-divide                      83.4449+-0.1224     ?     83.5295+-0.1573        ?
   aliased-arguments-getbyval                   4.6731+-0.3376            4.5395+-0.2956          might be 1.0294x faster
   arity-mismatch-inlining                      1.4191+-0.0251     ?      1.4315+-0.0318        ?
   big-int-mul                                 32.9276+-0.5568           32.6655+-0.4761        
   boolean-test                                 4.5333+-0.0345            4.5275+-0.0259        
   cast-int-to-double                          16.2419+-0.0161     ?     16.2871+-0.0744        ?
   cfg-simplify                                 7.5803+-0.0165     ?      7.5813+-0.0133        ?
   cmpeq-obj-to-obj-other                      16.6080+-0.2302     ?     16.8659+-0.2006        ? might be 1.0155x slower
   constant-test                               31.2405+-0.0972           31.1822+-0.1006        
   direct-arguments-getbyval                    0.8140+-0.0116            0.8115+-0.0146        
   double-pollution-getbyval                   10.0716+-0.0154     ?     10.0751+-0.0203        ?
   double-pollution-putbyoffset                 5.4735+-0.0803            5.4217+-0.0793        
   external-arguments-getbyval                  5.2910+-0.3174            5.2496+-0.3310        
   external-arguments-putbyval                  8.2970+-0.6693            8.2507+-0.6408        
   Float32Array-matrix-mult                    13.5300+-1.0099     ?     13.6370+-0.9756        ?
   fold-double-to-int                          38.6249+-0.1406           38.5781+-0.0806        
   function-dot-apply                           5.8333+-0.0385            5.7930+-0.0587        
   function-test                                5.3740+-0.0585     ^      5.2739+-0.0410        ^ definitely 1.0190x faster
   inline-arguments-access                      4.1494+-0.0279            4.1483+-0.0419        
   inline-arguments-local-escape               46.0531+-2.9262     ?     52.3115+-4.2389        ? might be 1.1359x slower
   int-overflow-local                         118.0483+-0.3662     ?    118.3313+-0.5207        ?
   Int16Array-bubble-sort                      81.0271+-2.4228           80.4548+-2.8448        
   Int16Array-load-int-mul                     18.1688+-0.1824           18.1451+-0.1931        
   Int8Array-load                               5.6627+-0.2763            5.4664+-0.0575          might be 1.0359x faster
   integer-divide                              17.0828+-0.0703           17.0743+-0.0811        
   method-on-number                           219.3700+-3.2640          218.6300+-3.5632        
   number-test                                  4.5098+-0.0160     ?      4.5275+-0.0261        ?
   object-test                                  4.8996+-0.0269            4.8714+-0.0283        
   poly-stricteq                              104.2680+-0.6172          103.7948+-0.3356        
   rare-osr-exit-on-local                     173.2102+-0.1526          173.0642+-0.1241        
   simple-activation-demo                      63.1580+-0.1389     ?     63.3731+-0.1316        ?
   slow-convergence                           103.9687+-0.6942     ?    104.1182+-0.6530        ?
   sparse-conditional                           2.0699+-0.0246            2.0646+-0.0161        
   string-hash                                 16.4398+-0.1261           16.2530+-0.1042          might be 1.0115x faster
   string-test                                  4.3049+-0.0373     ?      4.3897+-0.1093        ? might be 1.0197x slower
   tear-off-arguments                           4.6770+-0.3433            4.6492+-0.2970        
   to-int32-boolean                            33.1902+-0.2028     ?     33.2326+-0.1849        ?
   undefined-test                               4.8569+-0.0254     ?      4.8610+-0.0521        ?

   <arithmetic>                                34.7656+-0.1482     ?     34.8806+-0.2190        ? might be 1.0033x slower
   <geometric> *                               13.9761+-0.1355     ?     13.9857+-0.1514        ? might be 1.0007x slower
   <harmonic>                                   6.3049+-0.0579            6.2913+-0.0655          might be 1.0022x faster

                                                     BASE                     PATCH                                       
DSP:
   filtrr-posterize-tint                       56.6053+-0.6600           55.7920+-0.7078          might be 1.0146x faster
   filtrr-tint-contrast-sat-bright             94.0750+-1.4638     ^     85.9276+-0.8660        ^ definitely 1.0948x faster
   filtrr-tint-sat-adj-contr-mult             109.7405+-1.1978          108.5290+-0.7462          might be 1.0112x faster
   filtrr-blur-overlay-sat-contr              268.6270+-3.0472          266.4193+-4.5360        
   filtrr-sat-blur-mult-sharpen-contr         336.7590+-4.4060          334.5542+-5.6051        
   filtrr-sepia-bias                           38.3369+-0.7928     ?     38.4364+-0.6893        ?
   route9-vp8                         x5     1883.9348+-17.6787    ?   1886.5193+-12.0586       ?

   <arithmetic>                               938.5289+-8.2715          938.3868+-5.7269          might be 1.0002x faster
   <geometric> *                              404.9495+-1.8710     ^    400.5049+-1.2215        ^ definitely 1.0111x faster
   <harmonic>                                 150.9540+-1.2331     ^    148.2329+-1.2560        ^ definitely 1.0184x faster

                                                     BASE                     PATCH                                       
All benchmarks:
   <arithmetic>                               147.5150+-0.7835          147.2358+-0.5412          might be 1.0019x faster
   <geometric>                                 22.4585+-0.1002           22.3522+-0.1044          might be 1.0048x faster
   <harmonic>                                   5.1313+-0.0177            5.1181+-0.0261          might be 1.0026x faster

                                                     BASE                     PATCH                                       
Geomean of preferred means:
   <scaled-result>                             42.5566+-0.1818     ^     42.1645+-0.1087        ^ definitely 1.0093x faster

~>
Comment 3 Geoffrey Garen 2012-05-21 17:19:53 PDT
Created attachment 143144 [details]
Patch
Comment 4 Geoffrey Garen 2012-05-21 17:20:32 PDT
Re-uploading to trigger EWS, since I coded the UNIX and WINDOWS versions blind.
Comment 5 WebKit Review Bot 2012-05-21 17:22:59 PDT
Attachment 143144 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/WTF/wtf/AmountOfRAM.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:37:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 3 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Build Bot 2012-05-21 17:43:00 PDT
Comment on attachment 143144 [details]
Patch

Attachment 143144 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12730811
Comment 7 Geoffrey Garen 2012-05-21 17:51:38 PDT
Created attachment 143153 [details]
Patch
Comment 8 Geoffrey Garen 2012-05-21 18:09:12 PDT
Created attachment 143157 [details]
Patch
Comment 9 WebKit Review Bot 2012-05-21 18:11:45 PDT
Attachment 143157 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/WTF/wtf/AmountOfRAM.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:37:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 3 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Build Bot 2012-05-21 18:31:23 PDT
Comment on attachment 143157 [details]
Patch

Attachment 143157 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12733810
Comment 11 Build Bot 2012-05-21 19:31:48 PDT
Comment on attachment 143157 [details]
Patch

Attachment 143157 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12736795
Comment 12 Build Bot 2012-05-21 20:33:11 PDT
Comment on attachment 143157 [details]
Patch

Attachment 143157 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12749169
Comment 13 Build Bot 2012-05-21 21:35:23 PDT
Comment on attachment 143157 [details]
Patch

Attachment 143157 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12748282
Comment 14 Geoffrey Garen 2012-05-21 22:51:42 PDT
Created attachment 143192 [details]
Patch
Comment 15 Geoffrey Garen 2012-05-21 22:54:19 PDT
Created attachment 143193 [details]
Patch
Comment 16 WebKit Review Bot 2012-05-21 22:58:47 PDT
Attachment 143193 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/WTF/wtf/AmountOfRAM.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:37:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WTF/wtf/AmountOfRAM.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 3 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Build Bot 2012-05-21 23:17:09 PDT
Comment on attachment 143193 [details]
Patch

Attachment 143193 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12739714
Comment 18 Geoffrey Garen 2012-05-22 00:08:47 PDT
Created attachment 143205 [details]
Patch
Comment 19 WebKit Review Bot 2012-05-22 00:12:31 PDT
Attachment 143205 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/WTF/wtf/AmountOfRAM.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 20 Build Bot 2012-05-22 00:38:54 PDT
Comment on attachment 143205 [details]
Patch

Attachment 143205 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12749233
Comment 21 Geoffrey Garen 2012-05-22 10:16:42 PDT
Created attachment 143323 [details]
Patch
Comment 22 WebKit Review Bot 2012-05-22 10:20:05 PDT
Attachment 143323 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/WTF/wtf/AmountOfRAM.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 23 Darin Adler 2012-05-22 11:15:17 PDT
Comment on attachment 143323 [details]
Patch

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

> Source/JavaScriptCore/heap/Heap.cpp:49
> +static const size_t largeHeapSize = 32 * MB;
> +static const size_t smallHeapSize = 1 * MB;

Can you add “why” comments?

> Source/JavaScriptCore/heap/Heap.cpp:158
> +    if (heapSize < ramSize / 4)
> +        return 2 * heapSize;
> +    if (heapSize < ramSize / 2)
> +        return 1.5 * heapSize;
> +    return 1.25 * heapSize;

Can you add “why” comments?

> Source/JavaScriptCore/heap/Heap.cpp:237
> +    , m_ramSize(WTF::amountOfRAM())

The bug title calls this “system RAM” but you chose the term “amount of RAM”. Also not clear why an explicit WTF prefix is needed or helpful.

> Source/WTF/wtf/AmountOfRAM.cpp:76
> +    static size_t amountOfRAM = computeAmountOfRAM();

Could be static const.

> Source/WTF/wtf/AmountOfRAM.h:31
> +WTF_EXPORT_PRIVATE size_t amountOfRAM();

This file is missing "using WTF::amountOfRAM".

> Source/WTF/wtf/StdLibExtras.h:110
>  static const size_t KB = 1024;

Should be lowercase K. Not for this patch, though.
Comment 24 Geoffrey Garen 2012-05-22 12:17:02 PDT
Committed r118019: <http://trac.webkit.org/changeset/118019>
Comment 25 Jessie Berlin 2012-05-22 13:03:27 PDT
(In reply to comment #24)
> Committed r118019: <http://trac.webkit.org/changeset/118019>

Speculative build fix in http://trac.webkit.org/changeset/118031. Can you please check that it is the right fix?
Comment 26 Geoffrey Garen 2012-05-22 13:46:50 PDT
Follow-up build fix: <http://trac.webkit.org/changeset/118035>.