Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
理论上说,您只需在 [受硬件约束] 的尽可能多的线程中 [使用标准库] 生成随机数。C++ 在 Java 上的速度有多快?
没有磁盘 i/o、内存或 gc。只是纯 Math.random() 跨线程调用。
取决于硬件、操作系统和许多其他因素……我认为这是一个很难回答的问题,因为涉及的变量太多。你为什么不测试一下?
测试一下。请注意,Java 性能在运行时以上并不是静态的。因为它可以使用热点编译器,它会在检测到热点后对其进行编译。
在您将部署的环境中进行测试。