Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: test/js-perf-test/Templates/harmony-templates.js

Issue 769113002: Perf tests for Template Literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 new BenchmarkSuite('TemplateLiterals', [1000], [
6 new Benchmark('Untagged', false, false, 0,
7 Untagged, UntaggedSetup, UntaggedTearDown),
8 new Benchmark('TaggedRaw', false, false, 0,
9 TaggedRaw, TaggedRawSetup, TaggedRawTearDown),
10 ]);
11
12
13 var result;
14 var SUBJECT = 'Bob';
15 var TARGET = 'Mary';
16 var OBJECT = 'apple';
17
18 function UntaggedSetup() {
19 result = undefined;
20 }
21
22 function Untagged() {
23 result = `${SUBJECT} gives ${TARGET} an ${OBJECT}.`;
24 }
25
26 function UntaggedTearDown() {
27 var expected = '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + '.';
28 return result === expected;
29 }
30
31
32 // ----------------------------------------------------------------------------
33
34
35 function TaggedRawSetup() {
36 result = undefined;
37 }
38
39 function TaggedRaw() {
40 result = String.raw `${SUBJECT} gives ${TARGET} an ${OBJECT} \ud83c\udf4f.`;
41 }
42
43 function TaggedRawTearDown() {
44 var expected = '' + SUBJECT + ' gives ' + TARGET + ' an ' + OBJECT + ' \\ud83c \\udf4f.';
arv (Not doing code reviews) 2014/12/01 20:04:08 long line
45 return result === expected;
46 }
47
48
49 // ----------------------------------------------------------------------------
50
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698