pRizz / iota-transaction-spammer-webapp

https://prizz.github.io/iota-transaction-spammer-webapp/
MIT License
38 stars 13 forks source link

Pull request | Performance Improvements #12

Closed GpanosXP closed 6 years ago

GpanosXP commented 6 years ago

I have to say this project is excellent! Building a "miner" on webpage is a great idea for quick adoption by the community (as has already been proven).

Anyway, I made a few changes that stop gpu-intensive tasks from running when the browser is computing PoW: The css animations on the spinning logo and the progress bar, and the millisecond part in the timer. These tasks are stopped in a call from eventEmitter.on('working',...), when the transactions have been received and PoW has just started. Unfortunately, the iota.api does both the above actions together so I also had to modify the transactionSpammer submodule to call eventEmitter.emit('working') in between. I will make a separate pull request to cover that.

Results: The original version on my machine (internal gpu on ivy bridge desktop cpu) did around 25 confirmations in 10 mins. The modified version did around 55 in the same time. So we're looking for a 2x improvement under good network conditions. These improvement are going to be visible on mid and lower end machines, while high-end gpus are going to be bottlenecked by network unless (many) multiple nodes are used. In any case, I figured it's well worth the effort.

In addition, the split of the network and pow tasks in transactionSpammer.js creates more accurate logging (I added an extra log line there), showing exactly when the pc is idle and when working.

GpanosXP commented 6 years ago

After some more tests, it seems that the above results were circumstantial, and caused by different network conditions. The performance gain is in fact less significant, but hard to measure with accuracy.

Since the PR on the spammer sub-module on which this one depends has been closed, I would recommend to close this one too.

pRizz commented 6 years ago

Yeah; I'll copy my reddit comment on the issue: I hypothesize that disabling the animations will have a negligible impact on GPU performance because they are "slow" actions for the GPU (once every few ms) compared to crunching PoW (as fast as the clock allows, GHz).