Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Benchmark results

bdonlan edited this page Mar 16, 2015 · 3 revisions

Benchmark results as of this revision, run on a core i7-4770 CPU. To the greatest extent possible, these results try to extract just the invocation overhead.

Benchmark name java.lang.reflect.Proxy (ns/op) DynamicProxy (ns/op)
No-op handler 0.655 ± 0.003 0.262 ± 0.001
Single method, object arg 3.009 ± 0.074 2.379 ± 0.016
Single method, primitive arg 2.631 ± 0.017 2.073 ± 0.032
Single method, pass-through invocation 11.258 ± 0.049 2.030 ± 0.032
Multiple methods, primitive arg 8.078 ± 0.619 2.263 ± 0.142
Construction with state, cached 12.585 ± 0.070 7.074 ± 0.031

'Single method' benchmarks do not perform any conditional checks in the Proxy InvocationHandler; only the multiple methods benchmark does (this one uses a switch statement to dispatch to appropriate logic depending on which interface method is called).

Raw JMH results:

Benchmark                                         Mode  Cnt    Score   Error  Units
IndyProxyBenchmark.incDec                         avgt  200    2.293 ± 0.109  ns/op
IndyProxyBenchmark.incDec:incdec_decrement        avgt  200    2.305 ± 0.141  ns/op
IndyProxyBenchmark.incDec:incdec_increment        avgt  200    2.312 ± 0.141  ns/op
IndyProxyBenchmark.incDec:incdec_noop             avgt  200    2.263 ± 0.142  ns/op
IndyProxyBenchmark.proxy_nonPrims                 avgt  200    2.379 ± 0.016  ns/op
IndyProxyBenchmark.proxy_passThrough              avgt  200    2.030 ± 0.032  ns/op
IndyProxyBenchmark.proxy_passThrough_ctor_cached  avgt  200    7.074 ± 0.031  ns/op
IndyProxyBenchmark.proxy_prims                    avgt  200    2.073 ± 0.032  ns/op
IndyProxyBenchmark.proxy_voidMethod               avgt  200    0.262 ± 0.001  ns/op
ProxyBenchmark.incDec                             avgt  200    9.022 ± 0.498  ns/op
ProxyBenchmark.incDec:incdec_decrement            avgt  200    9.124 ± 0.667  ns/op
ProxyBenchmark.incDec:incdec_increment            avgt  200    9.863 ± 0.741  ns/op
ProxyBenchmark.incDec:incdec_noop                 avgt  200    8.078 ± 0.619  ns/op
ProxyBenchmark.proxy_nonPrims                     avgt  200    3.009 ± 0.074  ns/op
ProxyBenchmark.proxy_passThrough                  avgt  200   11.258 ± 0.049  ns/op
ProxyBenchmark.proxy_passThrough_ctor             avgt  200  281.577 ± 3.162  ns/op
ProxyBenchmark.proxy_passThrough_ctor_cached      avgt  200   12.585 ± 0.070  ns/op
ProxyBenchmark.proxy_prims                        avgt  200    2.631 ± 0.017  ns/op
ProxyBenchmark.proxy_voidMethod                   avgt  200    0.655 ± 0.003  ns/op
Clone this wiki locally