-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,7 @@ private PixelsCacheIdx search(ByteBuffer keyBuffer) | |
int bytesMatchedInNodeFound = 0; | ||
|
||
// get root | ||
// TODO: does root node have an edge? | ||
int currentNodeHeader = indexFile.getInt(currentNodeOffset); | ||
dramAccessCounter++; | ||
int currentNodeChildrenNum = currentNodeHeader & 0x000001FF; | ||
|
@@ -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? | ||
ray6080 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What is an edge? is it the key part to match on a node? 22bit -> 4MB edge size, it is so large. |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Currently, no, we can't do this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see. but can we merge the children and edge into one memory access? |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. It can be replaced by |
||
for (int i = 0, numEdgeBytes = currentNodeEdgeSize; i < numEdgeBytes && bytesMatched < keyLen; i++) | ||
{ | ||
if (currentNodeEdge[i] != keyBuffer.get(bytesMatched)) | ||
|
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.
Where is the root edge processed?