dwr icon indicating copy to clipboard operation
dwr copied to clipboard

Otimize assertIsNotOnBaseObject for performance

Open ratacolita opened this issue 5 years ago • 1 comments

assertIsNotOnBaseObject currently depends on throwing exception for its base case, that is, when the method is not one of Object's methods. That is very bad for performance because exceptions are slow in Java when they need to fill the stack trace. image The image shows a flame graph from a application running DRW. A lot of time is spent on NoSuchMethodException initialization.

I have done a micro benchmark of current implementation versus this proposed implementation: image The results above are for the case when the method is not one of Object's methods.

image The results above are for the case when the method is one of Object's methods.

GetMethodBenchmark.zip

ratacolita avatar Aug 19 '20 14:08 ratacolita

Thanks for your analysis and contribution! We will look into your suggestions in more detail later this year before preparing the next maintenance release.

mikewse avatar Aug 26 '20 09:08 mikewse