Skip to content
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

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

liran-funaro
Copy link
Contributor

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.

Copy link
Contributor

@sanastas sanastas left a 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.

core/src/main/java/com/yahoo/oak/EntryArray.java Outdated Show resolved Hide resolved
# Conflicts:
#	core/src/main/java/com/yahoo/oak/EntryArray.java
#	core/src/main/java/com/yahoo/oak/EntryOrderedSet.java
Copy link
Contributor

@sanastas sanastas left a 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);
Copy link
Contributor

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 {
Copy link
Contributor

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);
Copy link
Contributor

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

@liran-funaro liran-funaro merged commit e941e11 into yahoo:master Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants