Check out the new USENIX Web site. next up previous
Next: Optimizations Up: Performance Previous: Performance

Preliminary: Cost of Reflection

According to the way we have described our implementation, methods are invoked dynamically, i.e., through reified methods. Such dynamic invocations are much more expensive than static ones. Moreover, when subscribing to structurally conformant objects (cf. Section 3), method objects are obtained at runtime for each message object. Such lookups are very costly, and are summed with the overhead of the dynamic invocations.

Figure 17 shows the cost of dynamic calls by comparing the overhead of local method invocations with a varying number of arguments (between 0 and 10 objects). These are performed using (1) dynamic invocations, each combined with a method lookup, (2) dynamic invocations without lookups, and (3) static invocations. These tests were made on a SUN ULTRA 60 (SOLARIS 2.6, 256 Mb RAM, 9 Gb harddisk) with JAVA 1.2 (native threads). The test setting did not involve any JUST IN TIME (JIT) compiler. The speedup factor observed for static invocations when using a JIT compiler was over three. The speedup in the case of dynamic evaluation is, as expected, insignificant.

Figure 17: Latency with Different Invocation Styles


Patrick Eugster