[js-perf-tests] Fix micro-benchmark of spreading double arrays.

Array.prototype.map is currently not preserving PACKEDness. Use a
for-loop instead.

Bug: v8:7980
Change-Id: I08aff1cbcd84b9de260a5a1e2c68b9cfb5c3d888
Reviewed-on: https://chromium-review.googlesource.com/c/1280329
Commit-Queue: Hai Dang <dhai@google.com>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56657}
This commit is contained in:
Hai Dang 2018-10-15 17:42:31 +02:00 committed by Commit Bot
parent 1556cdeac6
commit d34cbcd789
3 changed files with 13 additions and 6 deletions

View File

@ -5,8 +5,12 @@
// Comparing different copy schemes against spread initial literals.
// Benchmarks for large packed double arrays.
const largeHoleyArray = new Array(1e5);
const largeArray = Array.from(largeHoleyArray.keys()).map(x => x + 6.66);
var largeArray = Array.from(Array(1e5).keys());
// TODO(dhai): we should be able to use Array.prototype.map here, but that
// implementation is currently creating a HOLEY array.
for (var i = 0; i < 1e5; i++) {
largeArray[i] += 6.66;
}
// ----------------------------------------------------------------------------
// Benchmark: Spread

View File

@ -5,8 +5,7 @@
// Comparing different copy schemes against spread initial literals.
// Benchmarks for large packed arrays.
const largeHoleyArray = new Array(1e5);
const largeArray = Array.from(largeHoleyArray.keys());
const largeArray = Array.from(Array(1e5).keys());
// ----------------------------------------------------------------------------
// Benchmark: Spread

View File

@ -5,8 +5,12 @@
// Comparing different copy schemes against spread initial literals.
// Benchmarks for small packed double arrays.
const smallHoleyArray = Array(100);
const smallArray = Array.from(Array(100).keys()).map(x => x + 6.66);;
var smallArray = Array.from(Array(100).keys());
for (var i = 0; i < 100; i++) {
smallArray[i] += 6.66;
}
// ----------------------------------------------------------------------------
// Benchmark: Spread