Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use typed arrays in Javascript runner. #382

Merged
merged 1 commit into from
Jul 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions iterations_runners/iterations_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,23 @@ load(BM_entry_point);
krun_init();
var BM_num_cores = krun_get_num_cores();

// Pre-allocate and fill arrays
var BM_wallclock_times = new Array(BM_n_iters);
BM_wallclock_times.fill(0);
// Pre-allocate and fill arrays.
// We use typed arrays to encourage type stability.
var BM_wallclock_times = new Float64Array(BM_n_iters);
BM_wallclock_times.fill(NaN);

var BM_cycle_counts = new Array(BM_num_cores);
var BM_aperf_counts = new Array(BM_num_cores);
var BM_mperf_counts = new Array(BM_num_cores);

for (BM_core = 0; BM_core < BM_num_cores; BM_core++) {
BM_cycle_counts[BM_core] = new Array(BM_n_iters);
BM_aperf_counts[BM_core] = new Array(BM_n_iters);
BM_mperf_counts[BM_core] = new Array(BM_n_iters);
BM_cycle_counts[BM_core] = new Float64Array(BM_n_iters);
BM_aperf_counts[BM_core] = new Float64Array(BM_n_iters);
BM_mperf_counts[BM_core] = new Float64Array(BM_n_iters);

BM_cycle_counts[BM_core].fill(0);
BM_aperf_counts[BM_core].fill(0);
BM_mperf_counts[BM_core].fill(0);
BM_cycle_counts[BM_core].fill(NaN);
BM_aperf_counts[BM_core].fill(NaN);
BM_mperf_counts[BM_core].fill(NaN);
}

// Main loop
Expand Down