-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
chunk: reduce chunk's iterator function call #7585
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.
LGTM
util/chunk/iterator.go
Outdated
} | ||
|
||
// Begin implements the Iterator interface. | ||
func (it *Iterator4Chunk) Begin() Row { | ||
if it.chk.NumRows() == 0 { | ||
it.numRows = it.chk.NumRows() | ||
if it.numRows == 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.
Is there any use case that we are iterating the chunk while appending into it simultaneously? I guess this is not allowed, just to make sure.
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.
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.
No, there isn't.
util/chunk/iterator.go
Outdated
} | ||
|
||
// Begin implements the Iterator interface. | ||
func (it *Iterator4Chunk) Begin() Row { | ||
if it.chk.NumRows() == 0 { | ||
it.numRows = it.chk.NumRows() | ||
if it.numRows == 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.
No, there isn't.
util/chunk/iterator.go
Outdated
chk *Chunk | ||
cursor int | ||
chk *Chunk | ||
cursor int |
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.
Can we change the type from int
to int32
to make Iterator4Chunk
only take 16 bytes in a 64-bit machine?
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.
LGTM
/run-all-tests |
What problem does this PR solve?
Reduce chunk's iterator function call.
What is changed and how it works?
Add
numRows int
to Iterator4Chunk.Below is a benchmark
old:
this branch