-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
Performance patch #2676
Performance patch #2676
Conversation
Jpx3
commented
Dec 10, 2023
- Convert a getDefault() != null check to a designated method hasDefault()
- Added a thread-safe and weak cache to the latter
* Convert a getDefault() != null check to a designated method hasDefault() * Added a thread-safe and weak cache to the latter
nice! would be interested to see the performance numbers if you have them |
@Jpx3 thank you! is that before or after? |
How about using guava |
yeah that's a good point. is there any advantage to keeping it thread-local? i'd imagine classes are instantiable or not regardless of thread |
Having it thread-local eliminates any locking by the map. This makes it thread-safe by design while still retaining its speed. And since we are talking about some class references and a few booleans, having some extra copies per thread doesn't matter that much. It will make the problem 50 times faster, but if you want to spend 4 hours thinking how to make it 51 times faster, we can elaborate this discussion 😅 |
fair enough! |
We're basically moving this problem behind the "plugins (or the server itself) start using virtual threads and users complain about performance again" barrier 😄 |
I would hope at that point java virtual threads have a solution to handle this. |