Closed Rkvishnu closed 1 year ago
//Outpoint generation: The current implementation generates a random outpoint using the random.randomBytes() function, which can be slow.
function dummy() { const hash = random.randomBytes(32); return new Outpoint(hash, 0); }
// MY SOLUTION---> 👇👇 // To optimize this, we can use a faster random number generator, such as crypto.randomBytes().
async function dummy() { const hash = await crypto.randomBytes(32); const index= Math.floor(Math.random() * 1000); return new Outpoint(hash, index); }
This is a file used to benchmark the performance of walletDB, since this is not performance critical, making it faster would not yield any fruitful outcome. Thanks for the efforts though.
//Outpoint generation: The current implementation generates a random outpoint using the random.randomBytes() function, which can be slow.
function dummy() { const hash = random.randomBytes(32); return new Outpoint(hash, 0); }
// MY SOLUTION---> 👇👇 // To optimize this, we can use a faster random number generator, such as crypto.randomBytes().
async function dummy() { const hash = await crypto.randomBytes(32); const index= Math.floor(Math.random() * 1000); return new Outpoint(hash, index); }