ronanyeah / pow-dapp

The world's first proof-of-work NFT 💥
https://pow.cafe/
9 stars 25 forks source link

kps increased from 6000 to 14175 #5

Closed Mudtjn closed 3 months ago

Mudtjn commented 8 months ago

There needed to be a condition, where if there is no start and end condition then the keypair is already a match. Also popping constantly from the keys array is a costly operation and using index to take keys. image

ronanyeah commented 8 months ago

Thanks, having a look.

ronanyeah commented 8 months ago
Mudtjn commented 8 months ago

I am unable to understand what it means about when will or else part of if(keypair) will hit. But have fixed increment conditions for the index.

ronanyeah commented 8 months ago

The keys array is a queue that will be filled by the first async loop, while the second async loop consumes the keys. Wouldn't there be a problem if the index = 5 and there are 3 elements in the array? They won't be checked. Using pop() prevents this.

Mudtjn commented 8 months ago

I was suggesting not to pop elements from keys array. I have used index to bypass the need to pop the elements from array. I won't be popping elements while using index.