C++与 Java 性能对比
理论上来说,您只需在尽可能多的线程中[使用标准库]生成随机数[受硬件限制]。 C++ 比 Java 快多快?
没有磁盘 I/O、内存或 gc。只是跨线程的纯 Math.random() 调用。
Say theoretically you just generate random numbers [using standard libraries] in as many threads as you can [bound by hardware]. How fast would C++ over Java?
no disk i/o, memory or gc. Just pure Math.random() calls across threads.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
取决于硬件、操作系统和许多其他因素......我认为这是一个很难回答的问题,因为涉及太多变量。你为什么不测试一下呢?
Depends on hardware, OS and many other factors... I think this a very hard question to answer, cause there is too many variables involved. Why don't you test it?
测试一下。
请注意,Java 性能在运行时并不是静态的。因为它可以使用热点编译器,所以在检测到热点后对其进行编译。
Test it.
And Pay attention to the fact, that Java performance is not static above runtime. Because it can use a hot spot compiler, that compiles the hot spots after it detects them.
在您将要部署的环境中测试两者。
test both in the environment you will be deploying at.