主题: 比较Javassist 和 ASM java 字节码框架
-
- Javassist source level API is much easier to use than the actual bytecode manipulation in ASM
- Javassist provides a higher level abstraction layer over complex bytecode level operations. Javassist source level API requires very less or no knowledge of actual bytecodes, so much easier & faster to implement.
- Javassist uses reflection mechanism which makes it slower compared to ASM which uses Classworking techniques at runtime.
- Overall ASM is much faster & gives better performance than Javassist. Javassist uses a simplified version of Java source code, which it then compiles into bytecode. That makes Javassist very easy to use, but it also limits the use of bytecode to what can be expressed within the limits of the Javassist source code.
- In conclusion, if someone needs easier way of dynamically manipulating or creating Java classes Javassist API should be used & where the performance is the key issue ASM library should be used.
-
Class construction times
-
Framework First time Later times Javassist 257 5.2 ASM 62.4 1.1