我正在寻找一个 Java 基准测试库。我对 Clojure 中Criterium基准测试库的功能很熟悉并且很满意。它具有以下特点:
* Statistical processing of multiple evaluations
* Inclusion of a warm-up period, designed to allow the JIT compiler to optimise its code
* Purging of gc before testing, to isolate timings from GC state prior to testing
* A final forced GC after testing to estimate impact of cleanup on the timing results
而且它的界面非常友好
(bench expr & opts)
打印摘要统计报告,例如:
=> (bench (Thread/sleep 1000))
Execution time mean : 1.000803 sec
Execution time std-deviation : 328.501853 us
Execution time lower quantile : 1.000068 sec ( 2.5%)
Execution time upper quantile : 1.001186 sec (97.5%)
我正在寻找一个类似的 Java 库,可能是一个公开了一个 bench 方法的库,该方法采用 Callable 或 Runnable 并打印类似的报告。如:
BenchMark.bench(new Callable<String>() {
@Override
public String call() { ... }
})
有谁知道啤酒库中的功能齐全、免费的开源软件?也许还包括内存统计信息?