sentry-java
sentry-java copied to clipboard
Check if entering synchronized block is necessary / double checked locking
Description
Some code uses synchronized blocks. We might gain a bit of performance by checking if we even need to acquire the lock.
- [ ]
LifecycleWatcher - [ ]
SentryTracer - [ ] ...
Did this come up from measuring something? If we're working on improving performance it's important to benchmark and find the areas that can be improved.
Came up in a code review, linked above. Agree on benchmarking as not to focus on micro optimizations.
oh, it's about adding a double check lock. If it's a heavy code path that will likely result in contention, where a double check lock can help, makes sense to add.