-
Notifications
You must be signed in to change notification settings - Fork 45
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
add comments #18
add comments #18
Conversation
pixels-cache/src/main/java/cn/edu/ruc/iir/pixels/cache/PixelsCacheReader.java
Show resolved
Hide resolved
@@ -137,6 +137,7 @@ private PixelsCacheIdx search(ByteBuffer keyBuffer) | |||
int bytesMatchedInNodeFound = 0; | |||
|
|||
// get root | |||
// TODO: does root node have an edge? |
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.
Yes. root node can also have an edge.
The first entry in the tree is stored in the root node.
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.
Yes. root node can also have an edge.
The first entry in the tree is stored in the root node.
Where is the root edge processed?
indexFile.getBytes(currentNodeOffset + 4 + currentNodeChildrenNum * 8, | ||
currentNodeEdge, 0, currentNodeEdgeSize); | ||
dramAccessCounter++; | ||
// TODO: numEdgeBytes seems redundant. |
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.
Yeah. It can be replaced by currentNodeEdgeSize
.
@@ -179,10 +180,13 @@ private PixelsCacheIdx search(ByteBuffer keyBuffer) | |||
dramAccessCounter++; | |||
currentNodeChildrenNum = currentNodeHeader & 0x000001FF; | |||
currentNodeEdgeSize = (currentNodeHeader & 0x7FFFFE00) >>> 9; | |||
// TODO: does max length of edge = 12? can we move currentNodeEdge allocation out before this loop? |
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 max length of edge is far larger than 12. It takes 22 bits for the size of edge in the node.
Node Header: isKey(1 bit) + edgeSize(22 bits) + childrenSize(9 bits).
I think we can move currentNodeEdge
out of the loop and make it a buffer only allocated once, if we make it large enough.
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 max length of edge is far larger than 12. It takes 22 bits for the size of edge in the node.
Node Header: isKey(1 bit) + edgeSize(22 bits) + childrenSize(9 bits).
I think we can move
currentNodeEdge
out of the loop and make it a buffer only allocated once, if we make it large enough.
What is an edge? is it the key part to match on a node? 22bit -> 4MB edge size, it is so large.
Currently, we have search key = 8 byte block id + 2 byte row group id + 2 byte column id.
byte[] currentNodeEdge = new byte[currentNodeEdgeSize]; | ||
// TODO: can we get header, edge and children of a node in one memory access? |
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.
Currently, no, we can't do this.
Since the size of edge and children are all stored in header.
We cannot access edge and children without accessing the header first.
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.
Currently, no, we can't do this.
Since the size of edge and children are all stored in header.
We cannot access edge and children without accessing the header first.
I see. but can we merge the children and edge into one memory access?
Review PixelsCacheReader.