lucene icon indicating copy to clipboard operation
lucene copied to clipboard

Replace Collections.synchronizedSet() with ConcurrentHashMap.newKeySet()

Open sabi0 opened this issue 1 year ago • 3 comments

ConcurrentHashMap.newKeySet() provides better multi-threaded performance thanks to judicious use of synchronization. Also it does not require "external" synchronization for iteration.

sabi0 avatar Feb 27 '24 22:02 sabi0

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!

github-actions[bot] avatar Mar 14 '24 00:03 github-actions[bot]

I'm out of office this week. If anybody can pick this up, please do. Otherwise I'll return to it next wek.

dweiss avatar Mar 14 '24 08:03 dweiss

Hi, I am fine to apply the "safe" changes where iteration or an atomic add+remove is not required. But all others should be reverted and external synchronization using synchronizedSet should be used. Let's only do this for simple sets where we never iterate and where we only check and add single entries from different threads. Uwe

uschindler avatar Mar 14 '24 11:03 uschindler

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!

github-actions[bot] avatar Mar 29 '24 00:03 github-actions[bot]