[js-perf-tests] Add more property accesses to module namespace micro-benchmark

Change-Id: Id9f60cdafc486de2b04684de84174f9765637c12
Reviewed-on: https://chromium-review.googlesource.com/601328
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47586}
This commit is contained in:
Adam Klein 2017-08-24 14:24:56 -07:00 committed by Commit Bot
parent f9a3a5af2a
commit 9315aa4b7e
3 changed files with 45 additions and 5 deletions

View File

@ -3,6 +3,27 @@
// found in the LICENSE file. // found in the LICENSE file.
import * as m from "value.js"; import * as m from "value.js";
for (let i = 0; i < iterations; ++i) m.set(m.value + 1); for (let i = 0; i < iterations; ++i) {
if (m.value != iterations) throw m.value; let accumulator = m.value;
accumulator += m.a0;
accumulator += m.a1;
accumulator += m.a2;
accumulator += m.a3;
accumulator += m.a4;
accumulator += m.a5;
accumulator += m.a6;
accumulator += m.a7;
accumulator += m.a8;
accumulator += m.a9;
accumulator += m.a10;
accumulator += m.a11;
accumulator += m.a12;
accumulator += m.a13;
accumulator += m.a14;
accumulator += m.a16;
accumulator += m.a17;
accumulator += m.a18;
accumulator += m.a19;
m.set(accumulator);
}
m.set(0); m.set(0);

View File

@ -5,7 +5,6 @@
load('../base.js'); load('../base.js');
new BenchmarkSuite('BasicExport', [100], [ new BenchmarkSuite('BasicExport', [100], [
new Benchmark('BasicExport', false, false, 0, BasicExport) new Benchmark('BasicExport', false, false, 0, BasicExport)
]); ]);
@ -18,8 +17,7 @@ new BenchmarkSuite('BasicNamespace', [100], [
new Benchmark('BasicNamespace', false, false, 0, BasicNamespace) new Benchmark('BasicNamespace', false, false, 0, BasicNamespace)
]); ]);
const iterations = 1000000;
const iterations = 3000000;
function BasicExport() { function BasicExport() {

View File

@ -4,3 +4,24 @@
export let value = 0; export let value = 0;
export function set(x) { value = x }; export function set(x) { value = x };
export let a0 = 0;
export let a1 = 1;
export let a2 = 2;
export let a3 = 3;
export let a4 = 4;
export let a5 = 5;
export let a6 = 6;
export let a7 = 7;
export let a8 = 8;
export let a9 = 9;
export let a10 = 10;
export let a11 = 11;
export let a12 = 12;
export let a13 = 13;
export let a14 = 14;
export let a15 = 15;
export let a16 = 16;
export let a17 = 17;
export let a18 = 18;
export let a19 = 19;