小编Koe*_*ikx的帖子

Java JIT在运行JDK代码时是否作弊?

我标杆一些代码,我不能让它以最快的速度奔跑着java.math.BigInteger使用完全相同的算法,即使.所以我将java.math.BigIntegersource 复制到我自己的包中并尝试了这个:

//import java.math.BigInteger;

public class MultiplyTest {
    public static void main(String[] args) {
        Random r = new Random(1);
        long tm = 0, count = 0,result=0;
        for (int i = 0; i < 400000; i++) {
            int s1 = 400, s2 = 400;
            BigInteger a = new BigInteger(s1 * 8, r), b = new BigInteger(s2 * 8, r);
            long tm1 = System.nanoTime();
            BigInteger c = a.multiply(b);
            if (i > 100000) {
                tm += System.nanoTime() - tm1; …
Run Code Online (Sandbox Code Playgroud)

java jit jvm jvm-hotspot

399
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×1

jit ×1

jvm ×1

jvm-hotspot ×1