Skip to content

Commit

Permalink
Bug 582814 Remove unneeded synchronized in IntIndexCollector::get
Browse files Browse the repository at this point in the history
The set is only called from parser, and not required for later gets.

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=582814
Change-Id: Ib4e59b5781dd4b79df9580f5df2779a984445f52
  • Loading branch information
jasonk000 committed Jan 15, 2024
1 parent b110b0d commit 04a285d
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,6 @@ public int next()
public void set(int index, int value)
{
ArrayIntCompressed array = getPage(index / pageSize);
// TODO unlock this by having ArrayIntCompressed use atomics
// uses bit operations internally, so we should sync against the page
synchronized(array)
{
array.set(index % pageSize, value);
Expand All @@ -715,13 +713,9 @@ public void set(int index, int value)

public int get(int index)
{
// set() only happens during parsing stage, get later
ArrayIntCompressed array = getPage(index / pageSize);

// TODO unlock this by having ArrayIntCompressed use atomics
// we currently lock a whole page, when we only need a single element
synchronized(array) {
return array.get(index % pageSize);
}
return array.get(index % pageSize);
}

public void close() throws IOException
Expand Down

0 comments on commit 04a285d

Please sign in to comment.