Brian's Waste of Time

Fri, 12 Dec 2003

Intercept Benchmarks - Wow!

Put together a quick benchmark to test some changes Chris made to the intercept library. He realized that instead of caching per class and doing a hash look up that we could just cache per-method and not even have to do an array index. He also reworked the matrix to make more use of method filtering in CGLIB. I need to get better at CGLIB as the results speak for themselves:

Release 0.1.2 (the last release)

    [junit] Testsuite: org.skife.intercept.Benchmark
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 131.226 sec
    [junit] ------------- Standard Output ---------------
    [junit] #   Direct (ms)    Intercepted (ms)    Overhead (%)
    [junit] 1   6423.0         10847.0              68.87747158648607
    [junit] 2   6400.0         10298.0              60.90625000000001
    [junit] 4   6373.0         10560.0              65.69904283696846
    [junit] 8   6385.0         11067.0              73.32811276429129
    [junit] 16   6402.0         11932.0              86.37925648234928
    [junit] 32   6404.0         13735.0              114.47532792004998
    [junit] 64   6370.0         17538.0              175.32182103610677
    [junit] ------------- ---------------- ---------------

Release 0.2 (current)

    [junit] Testsuite: org.skife.intercept.Benchmark
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 124.792 sec
    [junit] ------------- Standard Output ---------------
    [junit] #   Direct (ms)    Intercepted (ms)    Overhead (%)
    [junit] 1   6376.0         7220.0              13.237139272271015
    [junit] 2   6366.0         7331.0              15.158655356581852
    [junit] 4   6365.0         7579.0              19.07305577376277
    [junit] 8   6383.0         8015.0              25.567914773617417
    [junit] 16   6372.0         9464.0              48.5247959824231
    [junit] 32   6626.0         10821.0              63.3111983096891
    [junit] 64   6375.0         14674.0              130.18039215686272
    [junit] ------------- ---------------- ---------------

The first column is the number of interceptors on the invocation (I am afraid of an app with a 64 interceptor deep stack). The interceptor does nothing but immediately yield to the next interceptor in the stack. Eventually a virtual toString() is called that defaults back up to Object.toString(). Also, it requires a build of CGLIB against cvs at the moment, everything required should be in CGLIB 2.0 RC1 coming up though.

The benchmark is available in the source distro via ant benchmark

Managed to talk Chris into accepting cvs access =)

0 writebacks [/src/java/commons-intercept] permanent link