zzz.i2p

Development discussions
 
Fri, 08 May 2020, 09:48am #1
jogger
I2P Legend

I have often complained about poor Java performance when calculating SHA256 hashes. Went down to source and found that the inner loop "implCompress0" is expected to be implemented as a compiler intrinsic. Most popular JDK distros seem not to do this. You can check your JDK using:

java -XX:+UnlockDiagnosticVMOptions -XX:+UseSHA256Intrinsics -version

Googling around I found that Oracle implements this for Solaris on SPARC hardware, Azul does it in software for Linux on ARM (not sure about ARM hardware, would make the Odroid N2 a killer I2P machine).

Would like reports on any other OS / HW / JDK combo not failing the above test.

Mon, 11 May 2020, 09:53am #2
zzz
Administrator
Zzz

Interesting stuff. Failed on every JVM I tried.

Mon, 11 May 2020, 09:56pm #3
merope
Contributor

Total noob who's not familiar with JDK stuff: what's the expected output for a distribution with this feature vs one without?
I only seem to get information regarding the JDK version and build, and there's no difference with the output of just "java -version".
I guess that implies I don't have this feature built in?

Tue, 12 May 2020, 03:42pm #4
zzz
Administrator
Zzz

OP wasn't very clear... but the "failure" is something like:

OpenJDK 64-Bit Server VM warning: Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.

What he's looking for is "success", which would be a JVM that does NOT print that out. What it does print out instead, I don't know, and he didn't say. Probably just the version?

Wed, 13 May 2020, 06:33pm #5
jogger
I2P Legend

yep. The only JVM I tested that did not report the error "hash functions not available" is Zulu OpenJDK for ARM from Azul. It is a client JDK with SHA256intrinsics, pauseless GC and nice performance.

It crashes way too often in C1-compiled methods (11.0.7 LTS tried). Also the ThreadPoolExecutor frequently is late.

So this is no option. You have to pay first before you can submit your crash log as directed in the log itself.

Mon, 18 May 2020, 06:33pm #6
jogger
I2P Legend

Got a 50% solution. Turns out they released showcase software done by the book probably never meant for production. 2 levels deep of nested functions for less than a dozen simple bit manipulation operators. No way for the JIT compiler to deal with this.

Replace SHA2.java with the uploaded one, recompile your JDK. For me the error pattern of all worker threads stuck in SHA256 is gone.

Wed, 20 May 2020, 06:23pm #7
zzz
Administrator
Zzz

FYI for others: "uploaded one" is at http://zzz/i2p/files/SHA2.java