Does using Java Instrumentation decrease the performance of the JVM running it in any way? I’m using it for getting the (shallow) size of an object, and I’m wondering whether it affects the performance.
Does using Java Instrumentation decrease the performance of the JVM running it in any
Share
Yes, any additional code slows down the execution. It strongly depends what the code does, if you just log object sizes the performance impact will be negligible (in most if not all cases).
The instrumentation is done directly after the class file is loaded, so it happens only the first time, on longer running programs it shouldn’t have any further impact. If you remove the agent from you VM it surely will no longer have an influence.