-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Sync BitList for all the operations #14057
Conversation
Quality Gate passedIssues Measures |
@@ -93,23 +93,23 @@ public BitList(List<E> originList, BitSet rootSet, List<E> tailList) { | |||
} | |||
|
|||
// Provided by BitList only | |||
public List<E> getOriginList() { | |||
public synchronized List<E> getOriginList() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read behavior doesn't need to lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use a read and write lock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, reading without locking may lead to consistency issues.
@He-Pin If the operation itself is very short, using a read-write lock won't increase throughput. In fact, due to the internal complexity of the lock, it might even slow down. I've tested this with examples before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, at least at this case, this is not needed:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Be aware of the potential performance drop caused by lock.
What is the purpose of the change
Brief changelog
Verifying this change
Checklist