Reviewers: aklein, rossberg, wingo,

Message:
PTAL, it's a basic test, a simplified port of the microbenchmark I wrote on
jsperf to figure out why the new desugared version of rest params was so slow.

Description:
[es6] add js-perf-test for rest parameters

BUG=v8:2160
LOG=N
R=aklein, rossberg, wingo

Please review this at https://codereview.chromium.org/1317113007/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+45, -2 lines):
  M test/js-perf-test/JSTests.json
  A test/js-perf-test/RestParameters/rest.js
  A + test/js-perf-test/RestParameters/run.js


Index: test/js-perf-test/JSTests.json
diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json
index bff5b6536f66d24edf26eb7e48e75efc2a09c7e9..730972cdd556e3353f7c1cb850506db103042f2e 100644
--- a/test/js-perf-test/JSTests.json
+++ b/test/js-perf-test/JSTests.json
@@ -9,6 +9,19 @@
   "resources": ["base.js"],
   "tests": [
     {
+      "name": "RestParameters",
+      "path": ["RestParameters"],
+      "main": "run.js",
+      "resources": ["rest.js.js"],
+      "flags": ["--harmony-rest-parameters"],
+      "run_count": 5,
+      "units": "score",
+      "results_regexp": "^%s\\-RestParameters\\(Score\\): (.+)$",
+      "tests": [
+        {"name": "BasicRest1"}
+      ]
+    },
+    {
       "name": "SpreadCalls",
       "path": ["SpreadCalls"],
       "main": "run.js",
Index: test/js-perf-test/RestParameters/rest.js
diff --git a/test/js-perf-test/RestParameters/rest.js b/test/js-perf-test/RestParameters/rest.js
new file mode 100644
index 0000000000000000000000000000000000000000..181dec978a9f53dd98d7cea1f5561ff2a5fd47d5
--- /dev/null
+++ b/test/js-perf-test/RestParameters/rest.js
@@ -0,0 +1,30 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+new BenchmarkSuite('RestParameters', [1000], [
+  new Benchmark('BasicRest1', false, false, 0,
+                BasicRest1, BasicRest1Setup, BasicRest1TearDown)
+]);
+
+// ----------------------------------------------------------------------------
+
+var result;
+
+function basic_rest_fn_1(factor, ...values) {
+  var result = 0;
+  for (var i = 0; i < values.length; ++i) {
+    result += (factor * values[i]);
+  }
+  return result;
+}
+
+function BasicRest1Setup() {}
+
+function BasicRest1() {
+  result = basic_rest_fn_1(10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+}
+
+function BasicRest1TearDown() {
+  return result == 550;
+}
Index: test/js-perf-test/RestParameters/run.js
diff --git a/test/js-perf-test/Scope/run.js b/test/js-perf-test/RestParameters/run.js
similarity index 89%
copy from test/js-perf-test/Scope/run.js
copy to test/js-perf-test/RestParameters/run.js
index 9ce00a15a5ae3b9c221da343343369e1ec699be8..94ed06be420c368f858abb6bde44ad76cfd775a8 100644
--- a/test/js-perf-test/Scope/run.js
+++ b/test/js-perf-test/RestParameters/run.js
@@ -4,12 +4,12 @@


 load('../base.js');
-load('with.js');
+load('rest.js');

 var success = true;

 function PrintResult(name, result) {
-  print(name + '-Scope(Score): ' + result);
+  print(name + '-Object(Score): ' + result);
 }




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to