}
export async function score (runs, size, difficulty, effort, api) {
+ console.log(`%cNanoPow ${api}`, 'color:green', `Calculate truncated harmonic mean of the truncated arithmetic rate across ${runs} runs of ${size} samples.`)
const rates = []
for (let i = 0; i < runs; i++) {
const times = []
- console.log(`%cNanoPow ${api}`, 'color:green', `Calculate proof-of-work for ${runs} unique send block hashes`)
for (let j = 0; j < size; j++) {
document.getElementById('status').innerHTML = `SCORING IN PROGRESS. THIS WILL TAKE A LONG TIME. ${i}/${size} ${j}/${runs}<br/>`
const hash = random()
times.push(performance.now() - start)
}
const results = Object.values(average(times))[0]
- console.log(times)
- console.log(results)
const { truncatedRate } = results
rates.push(truncatedRate)
document.getElementById('output').innerHTML += `Benchmark ${i + 1} score: ${truncatedRate} wps<br/>`
const effort = document.getElementById('effort')
const api = document.getElementById('api')
const isOutputShown = document.getElementById('isOutputShown')
- score(+runs.value, +size.value, difficulty.value, +effort.value, api.value, isOutputShown.checked)
+ score(+runs.value, +size.value, difficulty.value, +effort.value, api.value)
.then(() => event.target.disabled = false)
}