msfroh commented on PR #15631: URL: https://github.com/apache/lucene/pull/15631#issuecomment-3947479849
@easyice -- I don't know the Java lock semantics well enough to know which is more expensive, acquiring a mutex or using an `AtomicReference`. I get the impression that if you have contention, the mutex will do better (since the atomic ref may need to retry the update), but if you usually don't have contention, the atomic ref will be better. I was able to get rid of the lock altogether (replacing it with optimistic locking from `getAndUpdate`) here: https://github.com/apache/lucene/commit/a946e65fd25fc53d2c848015e80049dcf5ed0447 I honestly don't know if that's any better though. As you said in the description, the impact may be minimal anyway. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
