[JSC] Add helpers to run Six Speed to run-jsc-benchmarks
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 05:54:21 +0000 (05:54 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 05:54:21 +0000 (05:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169351

Reviewed by Saam Barati.

PerformanceTests:

* SixSpeed/wrappers/wrapper.js: Added.
(assertEqual):
(test):
(jscRun):

Tools:

This patch adds an ability to run six-speed microbenchmarks
from run-jsc-benchmarks by specifying six-speed directory in
arewefastyet repository.

While it is a collection of microbenchmarks, it is useful
to ensure that our ES6 optimization covers major use cases.
For the macrobenchmark, we already have ARES-6.

* Scripts/run-jsc-benchmarks:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@213629 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/SixSpeed/wrappers/wrapper.js [new file with mode: 0644]
Tools/ChangeLog
Tools/Scripts/run-jsc-benchmarks

index e5a05f9..59a4092 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [JSC] Add helpers to run Six Speed to run-jsc-benchmarks
+        https://bugs.webkit.org/show_bug.cgi?id=169351
+
+        Reviewed by Saam Barati.
+
+        * SixSpeed/wrappers/wrapper.js: Added.
+        (assertEqual):
+        (test):
+        (jscRun):
+
 2017-03-08  Jon Davis  <jond@apple.com>
 
         Fixed ARES-6 animations for other browsers
diff --git a/PerformanceTests/SixSpeed/wrappers/wrapper.js b/PerformanceTests/SixSpeed/wrappers/wrapper.js
new file mode 100644 (file)
index 0000000..ff53d81
--- /dev/null
@@ -0,0 +1,17 @@
+function assertEqual(a, b)
+{
+}
+
+var targetFunction;
+function test(fn)
+{
+    targetFunction = fn;
+}
+
+function jscRun(iterations)
+{
+    var fn = targetFunction;
+    for (var i = 0; i < iterations; i++)
+        fn();
+
+}
index d3e3d2c..12dadc8 100644 (file)
@@ -1,3 +1,20 @@
+2017-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [JSC] Add helpers to run Six Speed to run-jsc-benchmarks
+        https://bugs.webkit.org/show_bug.cgi?id=169351
+
+        Reviewed by Saam Barati.
+
+        This patch adds an ability to run six-speed microbenchmarks
+        from run-jsc-benchmarks by specifying six-speed directory in
+        arewefastyet repository.
+
+        While it is a collection of microbenchmarks, it is useful
+        to ensure that our ES6 optimization covers major use cases.
+        For the macrobenchmark, we already have ARES-6.
+
+        * Scripts/run-jsc-benchmarks:
+
 2017-03-08  Sam Weinig  <sam@webkit.org>
 
         import-w3c-tests doesn't work with svn repositories.
index 83f92b3..9f48535 100755 (executable)
@@ -51,6 +51,7 @@ V8_PATH = PERFORMANCETESTS_PATH + "SunSpider" + "tests" + "v8-v6"
 MICROBENCHMARKS_PATH = OPENSOURCE_PATH + "JSTests" + "microbenchmarks"
 OCTANE_WRAPPER_PATH = PERFORMANCETESTS_PATH + "Octane" + "wrappers"
 JSBENCH_PATH = PERFORMANCETESTS_PATH + "JSBench"
+SIXSPEED_WRAPPER_PATH = PERFORMANCETESTS_PATH + "SixSpeed" + "wrappers"
 
 TEMP_PATH = OPENSOURCE_PATH + "BenchmarkTemp"
 
@@ -223,6 +224,7 @@ $includeBrowsermarkJS=false
 $includeBrowsermarkDOM=false
 $includeOctane=true
 $includeCompressionBench = true
+$includeSixSpeed = true
 $measureGC=false
 $benchmarkPattern=nil
 $verbosity=0
@@ -318,6 +320,7 @@ def usage
   puts "                     The default is to run all benchmarks. The above options can"
   puts "                     be combined to run any subset (so --sunspider --dsp will run"
   puts "                     both SunSpider and DSP)."
+  puts "--six-speed          Only run SixSpeed."
   puts "--benchmarks         Only run benchmarks matching the given regular expression."
   puts "--measure-gc         Turn off manual calls to gc(), so that GC time is measured."
   puts "                     Works best with large values of --inner.  You can also say"
@@ -1644,6 +1647,19 @@ class AsmBenchBenchmark
   end
 end
 
+class SixSpeedBenchmark
+  include Benchmark
+
+  def initialize(name, iterations)
+    @name = name
+    @iterations = iterations
+  end
+
+  def emitRunCode(plan)
+    emitBenchRunCode(fullname, plan, MultiFileTimedBenchmarkParameters.new([ensureFile("SixSpeed-#{@name}-wrapper", "#{SIXSPEED_WRAPPER_PATH}/wrapper.js"), ensureFile("SixSpeed-#{@name}", "#{SIXSPEED_PATH}/#{@name}")], simpleCommand("jscRun(#{@iterations});")))
+  end
+end
+
 
 class CompressionBenchBenchmark
   include Benchmark
@@ -2652,6 +2668,7 @@ begin
       $includeBrowsermarkDOM = false
       $includeOctane = false
       $includeCompressionBench = false
+      $includeSixSpeed = false
       $sawBenchOptions = true
     end
   end
@@ -2676,6 +2693,7 @@ begin
                  ['--browsermark-dom', GetoptLong::NO_ARGUMENT],
                  ['--octane', GetoptLong::NO_ARGUMENT],
                  ['--compression-bench', GetoptLong::NO_ARGUMENT],
+                 ['--six-speed', GetoptLong::NO_ARGUMENT],
                  ['--benchmarks', GetoptLong::REQUIRED_ARGUMENT],
                  ['--measure-gc', GetoptLong::OPTIONAL_ARGUMENT],
                  ['--force-vm-kind', GetoptLong::REQUIRED_ARGUMENT],
@@ -2776,6 +2794,9 @@ begin
     when '--compression-bench'
       resetBenchOptionsIfNecessary
       $includeCompressionBench = true
+    when '--six-speed'
+      resetBenchOptionsIfNecessary
+      $includeSixSpeed = true
     when '--benchmarks'
       $benchmarkPattern = Regexp.new(arg)
     when '--measure-gc'
@@ -2859,6 +2880,7 @@ begin
   BROWSERMARK_DOM_PATH = pathname_if_exist(config["BrowserMarkDOMPath"])
   ASMBENCH_PATH = pathname_if_exist(config["AsmBenchPath"])
   COMPRESSIONBENCH_PATH = pathname_if_exist(config["CompressionBenchPath"])
+  SIXSPEED_PATH = pathname_if_exist(config["SixSpeedPath"])
   DSPJS_FILTRR_PATH = pathname_if_exist(config["DSPJSFiltrrPath"])
   DSPJS_ROUTE9_PATH = pathname_if_exist(config["DSPJSRoute9Path"])
   DSPJS_STARFIELD_PATH = pathname_if_exist(config["DSPJSStarfieldPath"])
@@ -3029,6 +3051,41 @@ begin
     COMPRESSIONBENCH.add CompressionBenchBenchmark.new(*args)
   }
 
+  SIXSPEED = BenchmarkSuite.new("SixSpeed", :geometricMean, 0)
+  if SIXSPEED_PATH
+    [[ "template_string", 200000000 ],
+     [ "defaults", 100000000 ],
+     [ "map-set-lookup", 200000 ],
+     [ "spread", 1000000 ],
+     [ "object-assign", 600000 ],
+     [ "spread-literal", 1000000 ],
+     [ "map-set", 10000 ],
+     [ "destructuring-simple", 20000000 ],
+     [ "super", 3000000 ],
+     [ "for-of-object", 1000000 ],
+     [ "rest", 500000 ],
+     [ "regex-u", 1000000 ],
+     [ "arrow", 20000000 ],
+     [ "bindings-compound", 20000000 ],
+     [ "classes", 10000000 ],
+     [ "template_string_tag", 2000000 ],
+     [ "map-string", 30000000 ],
+     [ "arrow-declare", 30000000 ],
+     [ "spread-generator", 1000000 ],
+     [ "object-literal-ext", 1000000 ],
+     [ "generator", 3000000 ],
+     [ "arrow-args", 20000000 ],
+     [ "for-of-array", 5000000 ],
+     [ "bindings", 20000000 ],
+     [ "destructuring", 20000000 ],
+     [ "map-set-object", 5000 ],
+    ].each {
+      | name, iterations |
+      SIXSPEED.add SixSpeedBenchmark.new("#{name}.es5", iterations)
+      SIXSPEED.add SixSpeedBenchmark.new("#{name}.es6", iterations)
+    }
+  end
+
   DSPJS = BenchmarkSuite.new("DSP", :geometricMean, 0)
   DSPJS.add DSPJSFiltrrBenchmark.new("filtrr-posterize-tint", "e2")
   DSPJS.add DSPJSFiltrrBenchmark.new("filtrr-tint-contrast-sat-bright", "e5")
@@ -3150,6 +3207,15 @@ begin
     end
   end
 
+  if $includeSixSpeed and not SIXSPEED.empty?
+    if SIXSPEED_PATH
+      $suites << SIXSPEED
+    else
+      $stderr.puts "Warning: refusing to run SixSpeed because \"SixSpeedPath\" isn't set in #{$configPath}."
+    end
+  end
+
+
   $allSuites = $suites.map{|v| v.suites}.flatten(1)
   
   $benchmarks = []