cyb70289 commented on code in PR #14442:
URL: https://github.com/apache/arrow/pull/14442#discussion_r1000066822
##########
go/arrow/bitutil/bitmaps.go:
##########
@@ -390,15 +396,26 @@ func CopyBitmap(src []byte, srcOffset, length int, dst
[]byte, dstOffset int) {
rdr := NewBitmapWordReader(src, srcOffset, length)
wr := NewBitmapWordWriter(dst, dstOffset, length)
+ var modify func(in uint64) uint64
+ switch mode {
+ case transferCopy:
+ modify = func(in uint64) uint64 { return in }
+ case transferInvert:
+ modify = func(in uint64) uint64 { return ^in }
+ }
+
nwords := rdr.Words()
for nwords > 0 {
nwords--
- wr.PutNextWord(rdr.NextWord())
+ wr.PutNextWord(modify(rdr.NextWord()))
Review Comment:
Not familiar with optimization in go compiler. But won't this `modify()`
lead to a function call? Looks no better than `if` as the branch is pretty easy
to predict.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]