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

Unified Diff: test/js-perf-test/TypedArrays/sort.js

Issue 2691423003: [tests] Add js-perf-test for %TypedArray%.prototype.sort (Closed)
Patch Set: Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/js-perf-test/TypedArrays/copywithin.js ('k') | test/js-perf-test/TypedArrays/typedarrays.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/js-perf-test/TypedArrays/sort.js
diff --git a/test/js-perf-test/TypedArrays/sort.js b/test/js-perf-test/TypedArrays/sort.js
new file mode 100644
index 0000000000000000000000000000000000000000..aebc981e643cd2aefc9edfc6c138db88c5749a71
--- /dev/null
+++ b/test/js-perf-test/TypedArrays/sort.js
@@ -0,0 +1,33 @@
+// 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('Sort', [1000], [
+ new Benchmark('Sort', false, false, 0,
+ sortLarge, sortLargeSetup, sortLargeTearDown),
+]);
+
+var size = 3000;
+var initialLargeFloat64Array = new Array(size);
+for (var i = 0; i < size; ++i) {
+ initialLargeFloat64Array[i] = Math.random();
+}
+initialLargeFloat64Array = new Float64Array(initialLargeFloat64Array);
+var largeFloat64Array;
+
+function sortLarge() {
+ largeFloat64Array.sort();
+}
+
+function sortLargeSetup() {
+ largeFloat64Array = new Float64Array(initialLargeFloat64Array);
+}
+
+function sortLargeTearDown() {
+ for (var i = 0; i < size - 1; ++i) {
+ if (largeFloat64Array[i] > largeFloat64Array[i+1]) {
+ throw new TypeError("Unexpected result!\n" + largeFloat64Array);
+ }
+ }
+ largeFloat64Array = void 0;
+}
« no previous file with comments | « test/js-perf-test/TypedArrays/copywithin.js ('k') | test/js-perf-test/TypedArrays/typedarrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698