From 88df7dcaf44e8379e8345c30c550a3d18f61a6f9 Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Thu, 9 Feb 2017 18:38:30 +0100 Subject: [PATCH] [Test] Add TypedArray constructor benchmarks. Add a simple benchmark for a TypedArray constructor. Run once with the default pipeline and once with turbofan so that we can compare the performance. Also fixes a typo in the Regex for the result of the CopyWithin benchmark which stopped the results showing up in the perf dashboard. BUG= Change-Id: Ic2eb0bd1e02b458c1163e97130abd0e7531c2e1c Reviewed-on: https://chromium-review.googlesource.com/440225 Reviewed-by: Benedikt Meurer Commit-Queue: Peter Marshall Cr-Commit-Position: refs/heads/master@{#43087} --- test/js-perf-test/JSTests.json | 24 +++++++++++++++----- test/js-perf-test/TypedArrays/constructor.js | 11 +++++++++ test/js-perf-test/TypedArrays/run.js | 5 +--- 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 test/js-perf-test/TypedArrays/constructor.js diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json index e4e95104a7..2e2524ba31 100644 --- a/test/js-perf-test/JSTests.json +++ b/test/js-perf-test/JSTests.json @@ -278,13 +278,25 @@ { "name": "TypedArrays", "path": ["TypedArrays"], - "main": "run.js", - "resources": [ - "typedarrays.js" - ], - "results_regexp": "^TypedArrays\\-%s\\(Scope\\): (.+)$", + "results_regexp": "^TypedArrays\\-%s\\(Score\\): (.+)$", "tests": [ - {"name": "CopyWithin"} + { + "name": "CopyWithin", + "main": "run.js", + "test_flags": ["typedarrays"] + }, + { + "name": "Constructor", + "main": "run.js", + "test_flags": ["constructor"] + }, + { + "name": "Constructor--Future", + "flags": ["--future"], + "results_regexp": "^TypedArrays\\-Constructor\\(Score\\): (.+)$", + "main": "run.js", + "test_flags": ["constructor"] + } ] } ] diff --git a/test/js-perf-test/TypedArrays/constructor.js b/test/js-perf-test/TypedArrays/constructor.js new file mode 100644 index 0000000000..51bedc4a0b --- /dev/null +++ b/test/js-perf-test/TypedArrays/constructor.js @@ -0,0 +1,11 @@ +// Copyright 2017 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('Constructor', [1000], [ + new Benchmark('Constructor', false, false, 0, constructor), +]); + +function constructor() { + new Int32Array(16); +} diff --git a/test/js-perf-test/TypedArrays/run.js b/test/js-perf-test/TypedArrays/run.js index f0a65c2950..2df0b2d537 100644 --- a/test/js-perf-test/TypedArrays/run.js +++ b/test/js-perf-test/TypedArrays/run.js @@ -2,10 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - load('../base.js'); -load('typedarrays.js'); - +load(arguments[0] + '.js'); var success = true; @@ -13,7 +11,6 @@ function PrintResult(name, result) { print(`TypedArrays-${name}(Score): ${result}`); } - function PrintError(name, error) { PrintResult(name, error); success = false;