Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Otimize assertIsNotOnBaseObject for performance #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ratacolita
Copy link

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

@mikewse
Copy link
Contributor

mikewse commented Aug 26, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants