diff options
Diffstat (limited to 'deps/v8/test/js-perf-test/SixSpeed/array_destructuring/array_destructuring.js')
-rw-r--r-- | deps/v8/test/js-perf-test/SixSpeed/array_destructuring/array_destructuring.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/deps/v8/test/js-perf-test/SixSpeed/array_destructuring/array_destructuring.js b/deps/v8/test/js-perf-test/SixSpeed/array_destructuring/array_destructuring.js new file mode 100644 index 0000000000..f4a1d53f5c --- /dev/null +++ b/deps/v8/test/js-perf-test/SixSpeed/array_destructuring/array_destructuring.js @@ -0,0 +1,38 @@ +// Copyright 2016 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. + +// This benchmark is based on the six-speed benchmark build output. +// Copyright 2014 Kevin Decker <https://github.com/kpdecker/six-speed/> + + +new BenchmarkSuite('ArrayDestructuring-ES5', [1000], [ + new Benchmark('ES5', false, false, 0, ES5), +]); + +new BenchmarkSuite('ArrayDestructuring-ES6', [1000], [ + new Benchmark('ES6', false, false, 0, ES6), +]); + +// ---------------------------------------------------------------------------- +// Benchmark: ES5 +// ---------------------------------------------------------------------------- + +function ES5() { + "use strict"; + var data = [1, 2, 3]; + var c = data[0]; + return c; +} + + +// ---------------------------------------------------------------------------- +// Benchmark: ES6 +// ---------------------------------------------------------------------------- + +function ES6() { + "use strict"; + var data = [1, 2, 3]; + var [c] = data; + return c; +} |