tevador / RandomX

Proof of work algorithm based on random code execution
BSD 3-Clause "New" or "Revised" License
1.43k stars 307 forks source link

Competing implementation of RandomX in JavaScript. #306

Open l1mey112 opened 2 months ago

l1mey112 commented 2 months ago

RandomX.js has been implemented and tested extensively against the ground truth. It reaches a hashrate of 20 H/s per thread, quite higher than the original proposed speed of 1-2 H/s, but still 5x slower than light verification on the same machine (100 H/s). Among 8-16 threads it reaches 150-200 H/s.

I suggest you take a look. This may pave way for feasible webminers, though I doubt it unless I can micro optimise it further or AES-NI instructions are added to WebAssembly SIMD.

hyc commented 2 months ago

web mining was a cool idea but it'll never be as lucrative as ad placement, so webmasters have no reason to adopt it.

SChernykh commented 2 months ago

No AES, and no directed rounding means it will never be as fast as a native code. But only 5x difference is impressive. Also, web-mining can't use full mode (2 GB dataset), and that's another 10x slowdown.

Also,

All C++ code has been reimplemented or removed. C++ is a cancer that made the original library impossible to understand in one piece.

That's "I don't understand it therefore it's bad" attitude. C++ is a tool and it can be used in any way, including coding in C-style only. So it purely depends on the programmer, not the language itself to be "good or bad".

hyc commented 2 months ago

Fwiw, the use of exceptions in the C++ library has been a persistent source of hassles. IMO writing the library in C++ was always a bad idea and I rewrote it in C myself as well to remove these issues.

l1mey112 commented 2 months ago

I have created an issue on the repository to track possible performance improvements in tiers of how meaningful they may be compared to development cost:

https://github.com/l1mey112/randomx.js/issues/1