简体   繁体   English

对 Java 程序进行基准测试

[英]Benchmarking Java programs

For university, I perform bytecode modifications and analyze their influence on performance of Java programs.对于大学,我执行字节码修改并分析它们对 Java 程序性能的影响。 Therefore, I need Java programs---in best case used in production---and appropriate benchmarks.因此,我需要 Java 程序——最好在生产中使用——以及适当的基准测试。 For instance, I already got HyperSQL and measure its performance by the benchmark program PolePosition .例如,我已经获得了 HyperSQL 并通过基准程序PolePosition测量其性能。 The Java programs running on a JVM without JIT compiler.在没有 JIT 编译器的 JVM 上运行的 Java 程序。 Thanks for your help!谢谢你的帮助!

PS: I cannot use programs to benchmark the performance of the JVM or of the Java language itself (such as Wide Finder). PS:我无法使用程序来对 JVM 或 Java 语言本身(例如 Wide Finder)的性能进行基准测试。

Brent Boyer, wrote a nice article series for IBM developer works: Robust Java benchmarking , which is accompanied by a micro-benchmarking framework which is based on a sound statistical approach. Brent Boyer 为 IBM 开发人员的作品写了一篇不错的文章系列: Robust Java benchmarking ,伴随着一个基于合理统计方法的微基准测试框架。 Article and the Resources Page . 文章资源页面

Since, you do that for university, you might be interested in Andy Georges, Dries Buytaert, Lieven Eeckhout: Statistically rigorous java performance evaluation in OOPSLA 2007 .因为您是为大学而做的,所以您可能对Andy Georges、Dries Buytaert、Lieven Eeckhout:OOPSLA 2007 中的统计严谨的 Java 性能评估感兴趣。

Caliper is a tool provided by Google for micro-benchmarking. Caliper是 Google 提供的用于微基准测试的工具。 It will provide you with graphs and everything.它将为您提供图表和一切。 The folks who put this tool together are very familiar with the principle of "Premature Optimization is the root of all evil," (to jwnting's point) and are very careful in explaining the role of benchmarking.将这个工具放在一起的人非常熟悉“过早优化是万恶之源”的原则,(jwnting 的观点)并且在解释基准测试的作用时非常谨慎。

Any experienced programmer will tell you that premature optimisation is worse than no optimisation.任何有经验的程序员都会告诉你,过早优化比没有优化更糟糕。 It's a waste of resources at best, and a source of infinite future (and current) problems at worst.充其量是资源的浪费,最坏的情况是无限的未来(和当前)问题的根源。

Without context, any application, even with benchmark logs, will tell you nothing.没有上下文,任何应用程序,即使有基准日志,也不会告诉您任何信息。 I may have a loop in there that takes 10 hours to complete, the benchmark will show it taking almost forever, but I don't care because it's not performance critical.我可能有一个需要 10 小时才能完成的循环,基准测试将显示它几乎需要永远,但我不在乎,因为它不是性能关键。 Another loop takes only a millisecond but that may be too long because it causes me to fail to catch incoming data packets arriving at 100 microsecond intervals.另一个循环只需要一毫秒,但这可能太长了,因为它导致我无法捕获以 100 微秒间隔到达的传入数据包。

Two extremes, but both can happen (even in the same application), and you'd never know unless you knew that application, how it is used, what it does, under which conditions and requirements.两种极端情况,但两者都可能发生(即使在同一个应用程序中),除非您知道该应用程序、它是如何使用的、它做什么、在哪些条件和要求下,否则您永远不会知道。

If a user interface takes 1/2 second to render it may be too long or no problem, what's the context?如果用户界面需要 1/2 秒来呈现它可能太长或没有问题,那么上下文是什么? What are the user expectations?用户的期望是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM