Skip to content

Commit b1c569b

Browse files
committed
Time scoring in Node.js implementation
1 parent 1483633 commit b1c569b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ async function recalc_scores (runs_dir) {
9797
const { area_keys } = get_focus_areas()
9898
for (const [i, r] of all_runs.entries()) {
9999
const [date] = r.split('.')
100+
const start = Date.now()
100101
console.log(`Reading run ${runs_dir}/${r} (${i}/${run_count})`)
101102
const run = await read_compressed(`./${runs_dir}/${r}`)
103+
const start_score = Date.now()
102104
console.log(`Calculating score for run ${runs_dir}/${r} (${i}/${run_count})`)
103105
const score = score_run(run, new_run, test_to_areas, () => false)
104106
const row = [
@@ -111,6 +113,13 @@ async function recalc_scores (runs_dir) {
111113
row.push(score[area])
112114
}
113115
scores.push(row)
116+
117+
const end = Date.now()
118+
const read_time = start_score - start
119+
const score_time = end - start_score
120+
const total_time = end - start
121+
122+
console.log(`Done in ${total_time}ms (read in ${read_time}ms; scored in ${score_time}ms).`)
114123
}
115124

116125
return scores

0 commit comments

Comments
 (0)