v8/test/js-perf-test/ArraySort/sort-cmpfn.js
Simon Zünd af9e4ba2ca [jstests] Change sorting benchmarks to run setup for each iteration
This CL changes all ArraySort benchmarks to execute the setup
function for each iteration (one run call), instead of only once for
all iterations.

Even though we now also measure the time needed to copy and prepare
the array, this is needed, otherwise we would mainly measure sorting
already sorted arrays.

R=cbruni@chromium.org, jgruber@chromium.org

Change-Id: I2e0e301b52b0288b8c825c3c8401c348c4a0dee7
Reviewed-on: https://chromium-review.googlesource.com/1105045
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#53825}
2018-06-19 09:40:39 +00:00

21 lines
915 B
JavaScript

// Copyright 2018 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.
load('sort-base.js');
// Each benchmark calls sort with multiple different comparison functions
// to create polyomorphic call sites. Most/all of the
// other sort benchmarks have monomorphic call sites.
let sortfn = CreateSortFn([cmp_smaller, cmp_greater]);
createSortSuite('PackedSmi', 1000, sortfn, CreatePackedSmiArray);
createSortSuite('PackedDouble', 1000, sortfn, CreatePackedDoubleArray);
createSortSuite('PackedElement', 1000, sortfn, CreatePackedObjectArray);
createSortSuite('HoleySmi', 1000, sortfn, CreateHoleySmiArray);
createSortSuite('HoleyDouble', 1000, sortfn, CreateHoleyDoubleArray);
createSortSuite('HoleyElement', 1000, sortfn, CreateHoleyObjectArray);
createSortSuite('Dictionary', 1000, sortfn, CreateDictionaryArray);