You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
I have pushed a test release of the C++ generator.
You can build it yourself (instructions here) or download precompiled binaries from here. The precompiled binaries require AVX instruction set, so if your CPU doesn't support it, you have to build your own.
It consists of two binaries: randomjs (the generator) and xst (javascript engine).
It generates and executes 1000 programs and calculates Blake2b hashes of all outputs.
Post your performance numbers and CPU specs.
Xeon E3-1245 @3.7 GHz (Debian 9)
> ./randomjs
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 100.232 programs per second
From precompiled binaries.
Ryzen 1700x @ 3.4GHz Windows 10 Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79 Performance: 86.3199 programs per second
Core i7-4700HQ @ 2.4 GHz Windows 8.1 with 16gigs RAM
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 96.2629 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 95.4948 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 96.447 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 94.1722 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 99.5576 programs per second
@tevador Your precompiled binaries crash with exception code 0xC000001D (illegal instruction) on Pentium G5400 (Coffee Lake) because it doesn't support AVX. I had to recompile it with SSE2.
@SChernykh Yes, the precompiled binaries require AVX. I added a note to the original comment. I didn't realize there were still modern CPUs where Intel disables it.
Do the profile guided optimizations work in general or just for these particular 1000 programs? You can run a different set of programs by modifying the block header template in main.cpp. It would be best to read the block template and nonce count from the command line, but I didn't have time to implement it yet.
@tevador 1000 programs (~10 seconds of CPU time) is a big enough sample set for PGO to work well. It optimizes C/C++ code on low level and only needs execution statistics - which branches are executed more often, which if are taken and which are not and so on. In my experience, PGO almost always gives some improvement.
@SChernykh , are those optimizations to the code that will increase performance on any CPU? Or are they compile-time optimizations for the specs of the Ryzen?
Also, I assume these current binaries are for 1 thread. Is there any limit (i.e., cpu cache size) needed for each thread, or will it be able to run per thread regardless of cache size?
@Gingeropolous The limited testing I've done shows basically linear scaling with the number of cores. I haven't tested the impact of SMT, so I'm not sure if Ryzen will mine faster with 8 or 16 threads.
@SChernykh Are you are optimizing the XS engine or the JS generator? The generator takes only about ~6% of the time of one hash, so I'm not sure what optimizations can be done there. Can you push the code changes?
The PoW is not final yet. I'm planning some changes to the EvalExpression to increase FPGA resistance, but I have a lot of work this summer, so I don't have time to continue at the moment.
@tevador Most optimizations are in the XS engine, the only thing that I changed in RandomJS binary is IPC communicaton with XS engine. Not sure I can make a pull request right now since some of my optimizations are Windows only for now (memory allocator for example).
I added #ifdef guards to my Windows-only pieces of code and could compile and run it in Ubuntu:
osboxes@osboxes:~/RandomJS/src-cpp/bin$ ./randomjs
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 177.983 programs per second
It's even faster on virtual Linux machine without profile-guided optimizations than on real Windows with PGO. GCC compiler is superior! I'll prepare pull requests later today.
The PoW is not final yet. I'm planning some changes to the EvalExpression to increase FPGA resistance, but I have a lot of work this summer, so I don't have time to continue at the moment.
Sounds awesome. Could you possibly write out a rough sketch of the idea so someone else could pick up where you left off?
@SChernykh I have merged your code. Btw, I think we could avoid the call to atoi by prepending the program size as a 4-byte integer at the beginning rather than writing it in textual form.
@Gingeropolous It still requires a lot of research. The problem is that currently, there is a large variation in the number of EvalExpressions executed per program (IIRC it varies from as little as 8 to hundreds). The goal is to have a narrow range.
As I'm planning to remove the = from the eval chars, the low number of EvalExpressions would enable some theoretical attacks by assuming all EvalExpressions throw a SyntaxError and thus avoiding eval altogether.
The programs with a high number of EvalExpressions create long-running outliers, which is also undesirable. Throw/catch is slow and could be a potential optimization target.
i5-6600K @ 4.1 GHz , Windows 10, pre-compiled binaries
Performance: 123.777 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 123.409 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 123.018 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 121.82 programs per second
ryzen 2700x @ 4.0 GHz, Windows 10, pre-compiled binaries
Performance: 102.023 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 101.123 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 102.32 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 100.887 programs per second
New results with latest optimizations by @SChernykh
Same Threadripper did ~123 pps before :)
root@TR4:/usr/local/src/RandomJS/src-cpp/bin# for i in {1..10}; do ./randomjs; done
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.575 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.213 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 194.454 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 192.792 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.737 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.869 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.833 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 192.676 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 193.936 programs per second
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 194.189 programs per second
when I try to compile the new code, I get segfaults... but only on one box. O got it to compile on a different box and it runs fine.
New optimizations:
model name : AMD Opteron(tm) Processor 6172
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 60.5453 programs per second
won't compile on model name : Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz , even though I followed the same instructions. Interestingly, the precompiled binaries run on this machine, but not the opteron.
@SChernykh , when I tried to run the self-compiled binary (on the i7-7700k box), i get a segfault (but the precompiled binary you provided works fine on that box).
When I try to run the precompiled binary on the Opteron 6172, i get Illegal instruction (core dumped)
on ubuntu 18.10 I compiled xst and randomjs... they compiled fine but xst fails to run
So ./randomjs does nothing (you have to kill it)
I'm on a ThinkPad X240 with i5
Activity
SChernykh commentedon Jul 10, 2018
Intel Core i7-7820X @ 3.6 GHz (Windows 10). Built all binaries (release build) myself.
JohannesLau commentedon Jul 10, 2018
From precompiled binaries.
Ryzen 1700x @ 3.4GHz Windows 10
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79 Performance: 86.3199 programs per secondSChernykh commentedon Jul 10, 2018
Intel Core i7-7820X @ 3.6 GHz (Windows 10). Rebuilt all binaries using profile guided optimizations: 6.4% faster.
Edit: here are the precompiled binaries on the same PC
tevador commentedon Jul 10, 2018
Raspberry Pi 3 @ 1.2 GHz
(Note: To build for ARM, the currently used SSE2 version of Blake2b must be replaced by the reference or NEON optimized version.)
Cactii1 commentedon Jul 10, 2018
Core i7-4700HQ @ 2.4 GHz Windows 8.1 with 16gigs RAM
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 96.2629 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 95.4948 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 96.447 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 94.1722 programs per second
..\Wownero-Test>randomjs.exe
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 99.5576 programs per second
SChernykh commentedon Jul 10, 2018
@tevador Your precompiled binaries crash with exception code 0xC000001D (illegal instruction) on Pentium G5400 (Coffee Lake) because it doesn't support AVX. I had to recompile it with SSE2.
Intel Core i5-3210M @ 2.9 GHz, precompiled binaries:
Intel Core i5-3210M @ 2.9 GHz, my binaries with PGO:
Intel Pentium G5400 @ 3.7 GHz, my binaries without PGO:
Intel Pentium G5400 @ 3.7 GHz, my binaries with PGO:
tevador commentedon Jul 10, 2018
@SChernykh Yes, the precompiled binaries require AVX. I added a note to the original comment. I didn't realize there were still modern CPUs where Intel disables it.
Do the profile guided optimizations work in general or just for these particular 1000 programs? You can run a different set of programs by modifying the block header template in
main.cpp. It would be best to read the block template and nonce count from the command line, but I didn't have time to implement it yet.SChernykh commentedon Jul 10, 2018
@tevador 1000 programs (~10 seconds of CPU time) is a big enough sample set for PGO to work well. It optimizes C/C++ code on low level and only needs execution statistics - which branches are executed more often, which if are taken and which are not and so on. In my experience, PGO almost always gives some improvement.
zpalmtree commentedon Jul 10, 2018
Ryzen 1600 @ 3.6 GHz (Linux)
SChernykh commentedon Jul 12, 2018
@tevador Was it 64 bit or 32 bit build? Are there any differences between 32 and 64 bit?
tevador commentedon Jul 12, 2018
@SChernykh Ubuntu 16.04 armv7l (32bit). Haven't tested a 64bit build since the software support is still a bit lacking.
SChernykh commentedon Jul 15, 2018
Ryzen 1700 @ 3.6 GHz, Windows 10 (original testing binaries)
SChernykh commentedon Jul 20, 2018
Finally found a way to test it on 64-bit ARM - there are a number of cloud hosting providers that have ARM servers.
OS: Ubuntu 18.04 LTS
Compiler: g++ (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk revision 259383]
Processor: Cavium ThunderX 88XX @ 2GHz (aarch64)
tevador commentedon Jul 20, 2018
Interesting. The performance per clock seems to be significantly lower than Raspberry Pi 3 in 32-bit mode. Perhaps the CPU is an older model?
Can you also test a 32-bit build of the executables? I think the compiler flag is
-march=armv7.7 remaining items
Gingeropolous commentedon Jul 30, 2018
@SChernykh , are those optimizations to the code that will increase performance on any CPU? Or are they compile-time optimizations for the specs of the Ryzen?
Also, I assume these current binaries are for 1 thread. Is there any limit (i.e., cpu cache size) needed for each thread, or will it be able to run per thread regardless of cache size?
SChernykh commentedon Jul 30, 2018
@Gingeropolous These are algorithmic and C++ coding optimizations only. No assembly or compiler flags magic.
Edit: as I understood, it's supposed to run 1 process per CPU core.
Edit2: yes, my optimizations will work on any CPU.
tevador commentedon Jul 30, 2018
@Gingeropolous The limited testing I've done shows basically linear scaling with the number of cores. I haven't tested the impact of SMT, so I'm not sure if Ryzen will mine faster with 8 or 16 threads.
@SChernykh Are you are optimizing the XS engine or the JS generator? The generator takes only about ~6% of the time of one hash, so I'm not sure what optimizations can be done there. Can you push the code changes?
The PoW is not final yet. I'm planning some changes to the EvalExpression to increase FPGA resistance, but I have a lot of work this summer, so I don't have time to continue at the moment.
SChernykh commentedon Jul 30, 2018
@tevador Most optimizations are in the XS engine, the only thing that I changed in RandomJS binary is IPC communicaton with XS engine. Not sure I can make a pull request right now since some of my optimizations are Windows only for now (memory allocator for example).
SChernykh commentedon Jul 30, 2018
I added #ifdef guards to my Windows-only pieces of code and could compile and run it in Ubuntu:
It's even faster on virtual Linux machine without profile-guided optimizations than on real Windows with PGO. GCC compiler is superior! I'll prepare pull requests later today.
SChernykh commentedon Jul 30, 2018
XS pull request: tevador/moddable#9
RandomJS pull request: #7
Gingeropolous commentedon Jul 30, 2018
@tevador ,
Sounds awesome. Could you possibly write out a rough sketch of the idea so someone else could pick up where you left off?
tevador commentedon Jul 30, 2018
@SChernykh I have merged your code. Btw, I think we could avoid the call to atoi by prepending the program size as a 4-byte integer at the beginning rather than writing it in textual form.
@Gingeropolous It still requires a lot of research. The problem is that currently, there is a large variation in the number of EvalExpressions executed per program (IIRC it varies from as little as 8 to hundreds). The goal is to have a narrow range.
As I'm planning to remove the
=from the eval chars, the low number of EvalExpressions would enable some theoretical attacks by assuming all EvalExpressions throw a SyntaxError and thus avoiding eval altogether.The programs with a high number of EvalExpressions create long-running outliers, which is also undesirable. Throw/catch is slow and could be a potential optimization target.
miziel commentedon Jul 31, 2018
i5-6600K @ 4.1 GHz , Windows 10, pre-compiled binaries
ryzen 2700x @ 4.0 GHz, Windows 10, pre-compiled binaries
M5M400 commentedon Jul 31, 2018
New results with latest optimizations by @SChernykh
Same Threadripper did ~123 pps before :)
Gingeropolous commentedon Aug 5, 2018
when I try to compile the new code, I get segfaults... but only on one box. O got it to compile on a different box and it runs fine.
New optimizations:
model name : AMD Opteron(tm) Processor 6172
Cumulative output hash: bb3bffd3d0eef49066bf5c8e664c082c502fe021a7cdc0cd0c44fe1990560b79
Performance: 60.5453 programs per second
won't compile on model name : Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz , even though I followed the same instructions. Interestingly, the precompiled binaries run on this machine, but not the opteron.
SChernykh commentedon Aug 5, 2018
You get segfaults during compilation or when you try to run the compiled binary?
Gingeropolous commentedon Aug 5, 2018
@SChernykh , when I tried to run the self-compiled binary (on the i7-7700k box), i get a segfault (but the precompiled binary you provided works fine on that box).
When I try to run the precompiled binary on the Opteron 6172, i get
Illegal instruction (core dumped)OpticFlowX commentedon Aug 6, 2018
Hi, is it possible to provide binaries for older architectures? Like Intel Core2 for example (-march=core2 on gcc)? Or AVX is a must-have?
ouillepouille commentedon Oct 4, 2018
on ubuntu 18.10 I compiled xst and randomjs... they compiled fine but xst fails to run
So ./randomjs does nothing (you have to kill it)
I'm on a ThinkPad X240 with i5