ActiveJ Specializer is an innovative technology for enhancing class runtime performance for JVM. It is one of the ActiveJ technologies with no third-party dependencies, so it can be used as a stand-alone component.
ActiveJ Specializer uses ASM library to automatically transform class instances into specialized static classes, and class instance fields into baked-in static fields. This enables a wide variety of JVM optimizations for static classes, not possible otherwise: dead code elimination, aggressively inlining methods, and static constants. According to our measures, resulting speed-up could be up to 30%-50% in some cases.
This simple example illustrates the core ActiveJ Specializer concept. Suppose there is an
INT_UNARY_OPERATOR that can be simplified.
INT_UNARY_OPERATOR_SPECIALIZED specializes the equation similarly to the
INT_UNARY_OPERATOR_SPECIALIZED_MANUALLY, but does this automagically.
According to the benchmarks the original equation was operated in 69.938 ns, while the manually and automatically specialized took only 26.533 ns and 26.691 ns respectively.
ActiveJ Specializer goes far beyond arithmetic equations and can be used in complex use cases. For example, according to the benchmarks ActiveJ Specializer makes ActiveJ Inject DI library faster by third. To apply ActiveJ Specializer to ActiveJ Inject, simply add
Injector.useSpecializer() before Injector instantiation.