-
Notifications
You must be signed in to change notification settings - Fork 48
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
Support on/off-heap entry array #197
Conversation
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.
The change looks good to me. I have almost nothing to say. Just request to rerun the benchmarks and check no performance impact again.
# Conflicts: # core/src/main/java/com/yahoo/oak/EntryArray.java # core/src/main/java/com/yahoo/oak/EntryOrderedSet.java
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.
The code looks good, some comments inside
@@ -70,25 +70,25 @@ public int fieldCount() { | |||
/** {@inheritDoc} */ | |||
@Override | |||
public void clear() { | |||
UnsafeUtils.UNSAFE.setMemory(null, entriesAddress, buffer.capacity(), (byte) 0); | |||
DirectUtils.UNSAFE.setMemory(null, entriesAddress, buffer.capacity(), (byte) 0); |
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.
For some interfaces DirectUtils
has APIs like getLong
or putLong
and other interfaces are invoked referring to UNSAFE
directly. Is it possible to move things like setMemory(...)
to DirectUtils
APIs?
/** | ||
* Abstraction for array of entries, where each entry has multiple fields (long). | ||
*/ | ||
public interface EntryArrayInternal { |
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.
I liked more EntryArray
as a name for the interface and EntryArrayInternal
as a name for implementation. Is it possible to swap between the names?
this.fields = additionalFieldCount + 2; // +2 for key and value references that always exist | ||
this.entries = new long[entriesCapacity * this.fields]; | ||
// +2 for key and value references that always exist | ||
this.array = new EntryArrayHeap(entriesCapacity, additionalFieldCount + 2); |
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.
May be to put additionalFieldCount + 2
to a variable named fieldsPerEntryCounter
, or to add some comment, to make it a bit clearer
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.