主题: 比较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
本文对比了Javassist和ASM这两个Java字节码框架。Javassist提供更高级别的抽象,易于使用,但速度较慢;而ASM直接操作字节码,性能更优。若需快速动态操作Java类,宜选Javassist;如性能为关键,则ASM更佳。
298

被折叠的 条评论
为什么被折叠?



