OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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('CopyWithin', [1000], [ |
| 6 new Benchmark('CopyWithin-Large', false, false, 0, |
| 7 CopyWithinLarge, CopyWithinLargeSetup, CopyWithinLargeTearDown), |
| 8 ]); |
| 9 |
| 10 var initialLargeFloat64Array = new Array(10000); |
| 11 for (var i = 0; i < 5000; ++i) { |
| 12 initialLargeFloat64Array[i] = i; |
| 13 } |
| 14 initialLargeFloat64Array = new Float64Array(initialLargeFloat64Array); |
| 15 var largeFloat64Array; |
| 16 |
| 17 function CopyWithinLarge() { |
| 18 largeFloat64Array.copyWithin(5000); |
| 19 } |
| 20 |
| 21 function CopyWithinLargeSetup() { |
| 22 largeFloat64Array = new Float64Array(initialLargeFloat64Array); |
| 23 } |
| 24 |
| 25 function CopyWithinLargeTearDown() { |
| 26 for (var i = 0; i < 5000; ++i) { |
| 27 if (largeFloat64Array[i + 5000] !== i) { |
| 28 throw new TypeError("Unexpected result!\n" + largeFloat64Array); |
| 29 } |
| 30 } |
| 31 largeFloat64Array = void 0; |
| 32 } |
OLD | NEW |