Benchmarking script
This commit is contained in:
@ -181,5 +181,44 @@
|
||||
<button id="ready-button">Not ready</button>
|
||||
<button id="end-turn" class="hidden">End Turn</button>
|
||||
</div>
|
||||
|
||||
<!-- Benchmarking script -->
|
||||
<script>
|
||||
function RSABench() {
|
||||
console.log("Warming up")
|
||||
|
||||
for (let i = 0n; i < 100n; i++) {
|
||||
window.rsa.pubKey.encrypt(i);
|
||||
}
|
||||
|
||||
console.log("Benching")
|
||||
|
||||
performance.mark("rsa-start")
|
||||
for (let i = 0n; i < 250n; i++) {
|
||||
window.rsa.pubKey.encrypt(i);
|
||||
}
|
||||
performance.mark("rsa-end")
|
||||
|
||||
console.log(`Bench done. Duration: ${performance.measure("rsa-duration", "rsa-start", "rsa-end").duration}`)
|
||||
}
|
||||
|
||||
function PaillierBench() {
|
||||
console.log("Warming up")
|
||||
|
||||
for (let i = 0n; i < 100n; i++) {
|
||||
window.paillier.pubKey.encrypt(i);
|
||||
}
|
||||
|
||||
console.log("Benching")
|
||||
|
||||
performance.mark("paillier-start")
|
||||
for (let i = 0n; i < 250n; i++) {
|
||||
window.paillier.pubKey.encrypt(i);
|
||||
}
|
||||
performance.mark("paillier-end")
|
||||
|
||||
console.log(`Bench done. Duration: ${performance.measure("paillier-duration", "paillier-start", "paillier-end").duration}`)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user