Search code examples
javaperformancejpaload-time-weavingcompile-time-weaving

JPA - Performance impact of weaving


I am unable to find any benchmark or large scale test that shows the performance gain of static weaving versus dynamic weaving. Does somebody has any experience with this ?


Solution

  • After classloading there should not be any difference in performance. The difference is in classloading itself where you will have a certain penalty in exchange for the flexibility to weave during runtime instead of during compile time. I am not an EclipseLink user, but know quite something about AOP and weaving in general, so I can tell you that the difference can be anything from unnoticeable to several seconds when an application starts up, heavily depending on the number and types of loaded classes and the complexity and scope (applied to many or just a few classes) of woven-in functionality. So it probably does not make sense to generalise here. Benchmarks would only make sense for certain types of reference applications on predefined hardware setups.

    Having said that, I cannot really help you but just recommend that you do the benchmark by yourself for your individual setup. It should be easy enough to switch weaving types. Static weaving requires adjustments in your build process, dynamic weaving requires you to start the JVM with a weaving agent. Both options are not rocket science. Good luck!