TilmanNeumann / java-math-library

A Java math library focused on number theory and integer factorization in particular.
GNU General Public License v3.0
29 stars 7 forks source link

UnSafe Sun package #19

Closed Pascal66 closed 4 years ago

Pascal66 commented 4 years ago

Maybe the next part to clean ? Or keep for historical purpose ? With Unsafe : 966983290915691193309978723256242679920691599725908954700676674631843021151 (250 bits) = 2166660942804222727904664493239497749 * 446301159453293757389122758418041256099 (factored in 58s, 152ms) Without: 966983290915691193309978723256242679920691599725908954700676674631843021151 (250 bits) = 2166660942804222727904664493239497749 * 446301159453293757389122758418041256099 (factored in 57s, 519ms)

TilmanNeumann commented 4 years ago

A single test is no proof ;-) In my experience, the unsafe implementation has always been clearly faster. But of course, I have only been testing with a single and quite old computer.

Which Java version did you use, and which hardware?

Pascal66 commented 4 years ago
# JMH version: 1.22
# VM version: JDK 1.8.0_212-release, OpenJDK 64-Bit Server VM, 25.212-b04
# VM options: -XX:-RestrictContended -XX:+AggressiveOpts -XX:NewSize=16m -XX:MaxTenuringThreshold=1 -XX:+UseParallelGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xms4g -Xmx4g

I use jdk 1.8 because the unsafe part usage isnt clear in future of java, and (for me and my old computer this give not so much improvment (~10% in not all case)

It's not a single test.. It's an example of the result of many tests. As the code is very very well optimized, i'm searching for the little part wich can do the same things of unsafe part.

TilmanNeumann commented 4 years ago

It's not a single test.. It's an example of the result of many tests. As the code is very very well optimized, i'm searching for the little part wich can do the same things of unsafe part.

Well done then, I'll keep it in mind. Thanks for your extensive tests. To m knowledge you are the first person who has embraced the capabilities of class FactorizerTest :-)