Reviewers: ,

Message:
PTAL

I'm having some trouble actually getting the NotifyResult callback to actually be triggered, possibly because each step is happening too quickly. (I was hoping
I could get some help with that)

The test templates are fairly small, to simplify writing, but we could do really long ones too --- it's just hard to do this nicely without the use of eval() or
similar.

Description:
Perf tests for Template Literals

BUG=

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

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

Affected files (+66, -2 lines):
  A test/js-perf-test/Templates/Templates.json
  A test/js-perf-test/Templates/harmony-templates.js
  A + test/js-perf-test/Templates/run.js


Index: test/js-perf-test/Templates/Templates.json
diff --git a/test/js-perf-test/Templates/Templates.json b/test/js-perf-test/Templates/Templates.json
new file mode 100644
index 0000000000000000000000000000000000000000..87832e2f972d951631bf0076e23a8083e6efd876
--- /dev/null
+++ b/test/js-perf-test/Templates/Templates.json
@@ -0,0 +1,13 @@
+{
+  "name": "JSTests/Templates",
+  "path": ["."],
+  "main": "run.js",
+  "flags": ["--harmony-templates"],
+  "run_count": 5,
+  "units": "score",
+  "results_regexp": "^%s\\-Templates\\(Score\\): (.+)$",
+  "total": true,
+  "tests": [
+    {"name": "TemplateLiterals"}
+  ]
+}
Index: test/js-perf-test/Templates/harmony-templates.js
diff --git a/test/js-perf-test/Templates/harmony-templates.js b/test/js-perf-test/Templates/harmony-templates.js
new file mode 100644
index 0000000000000000000000000000000000000000..533f9d408a305095c1bd89405ac9fc84aedd5efb
--- /dev/null
+++ b/test/js-perf-test/Templates/harmony-templates.js
@@ -0,0 +1,51 @@
+// Copyright 2014 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('TemplateLiterals', [1000], [
+  new Benchmark('Untagged', false, false, 0,
+                Untagged, UntaggedSetup, UntaggedTearDown),
+  new Benchmark('TaggedRaw', false, false, 0,
+                TaggedRaw, TaggedRawSetup, TaggedRawTearDown),
+]);
+
+
+var result;
+var SUBJECT = 'Bob';
+var TARGET = 'Mary';
+var OBJECT = 'apple';
+
+function UntaggedSetup() {
+  result = undefined;
+}
+
+function Untagged() {
+  result = `${SUBJECT} gives ${TARGET} an ${OBJECT}.`;
+}
+
+function UntaggedTearDown() {
+  var expected = '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + '.';
+  return result === expected;
+}
+
+
+// ----------------------------------------------------------------------------
+
+
+function TaggedRawSetup() {
+  result = undefined;
+}
+
+function TaggedRaw() {
+ result = String.raw `${SUBJECT} gives ${TARGET} an ${OBJECT} \ud83c\udf4f.`;
+}
+
+function TaggedRawTearDown() {
+ var expected = '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + ' \\ud83c\\udf4f.';
+  return result === expected;
+}
+
+
+// ----------------------------------------------------------------------------
+
+
Index: test/js-perf-test/Templates/run.js
diff --git a/test/js-perf-test/Iterators/run.js b/test/js-perf-test/Templates/run.js
similarity index 87%
copy from test/js-perf-test/Iterators/run.js
copy to test/js-perf-test/Templates/run.js
index ff4897fa13e622083fb171630677f27dca75bc56..6c079281b2433329e36d530ba77792a90e96d5c3 100644
--- a/test/js-perf-test/Iterators/run.js
+++ b/test/js-perf-test/Templates/run.js
@@ -4,13 +4,13 @@


 load('../base.js');
-load('forof.js');
+load('harmony-templates.js');


 var success = true;

 function PrintResult(name, result) {
-  print(name + '-Iterators(Score): ' + result);
+  print(name + '-Templates(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