}
}
- function print (times) {
- const { arithmetic, count, geometric, harmonic, min, max, rate, total, truncated } = average(times)
- console.log(`Count: ${count} nonces`)
- console.log(`Total: ${total} ms`)
- console.log(`Rate: ${rate} nonces/second`)
- console.log(`Minimum: ${min} ms`)
- console.log(`Maximum: ${max} ms`)
- console.log(`Arithmetic Mean: ${arithmetic} ms`)
- console.log(`Truncated Mean: ${truncated} ms`)
- console.log(`Harmonic Mean: ${harmonic} ms`)
- console.log(`Geometric Mean: ${geometric} ms`)
- }
-
export async function run (size, effort, isOutputShown, isGlForced, isDebug) {
if (isGlForced) NanoPow = NanoPowGl
document.getElementById('status').innerHTML = `TESTING IN PROGRESS 0/${size}`
let work = null
const start = performance.now()
try {
- work = await NanoPow.search(hash, { effort, debug: isDebug })
+ work = await NanoPow.search(hash, { threshold: 0, effort, debug: isDebug })
} catch (err) {
document.getElementById('output').innerHTML += `Error: ${err.message}<br/>`
console.error(err)
}
const end = performance.now()
- const isValid = (await NanoPow.validate(work, hash)) ? 'VALID' : 'INVALID'
+ const isValid = (await NanoPow.validate(work, hash, { threshold: 0 })) ? 'VALID' : 'INVALID'
times.push(end - start)
const msg = `${isValid} [${work}] ${hash} (${end - start} ms)`
// console.log(msg)
}
document.getElementById('output').innerHTML += `<hr/>`
document.getElementById('summary').innerHTML += `${JSON.stringify(average(times, effort), null, '\t')}<br/>`
- print(times)
document.getElementById('status').innerHTML = `TESTING COMPLETE<br/>`
console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')
}