如果 J***a 有 goroutine ,你們還會用 golang 嗎 ?

发布日期:2025-06-19 00:50:11 浏览次数:0

在1-10000000 之间寻找素数,同样逻辑,四核cpu,16g内存配置下,执行时间 j***a 13.76s ,go 37.14s。

自己做实验才知道哪个更快。

在虚拟线程 我这个cpu密集计算中胜goroutine。

j***a代码:Time take: PT13.185036S import j***a.util.concurrent.atomic.AtomicInteger; import j***a.time.Duration; import j***a.time.Instant; public class PrimeFinder { public static boolean isPrime(int n) { if (n <= 1) { return false; }…。

如果 J***a 有 goroutine ,你們還會用 golang 嗎 ?