daniel-adam-tfs commented on code in PR #477:
URL: https://github.com/apache/arrow-go/pull/477#discussion_r2281753735


##########
parquet/internal/utils/bit_reader.go:
##########
@@ -152,24 +169,67 @@ func (b *BitReader) GetAligned(nbytes int, v interface{}) 
bool {
        if n != nbytes {
                return false
        }
+
        // zero pad the bytes
-       memory.Set(b.raw[n:typBytes], 0)
-
-       switch v := v.(type) {

Review Comment:
   We could make this generic:
   
   func GetAligned[T ...](b *BitReader, v *T)
   
   I didn't because I wanted to avoid casting to interface{} so I can do a type 
switch, but in my cpu profiles that switch was pretty fast. The slowest thing 
in the original code was the call to reflect package, but in the generic 
version unsafe.Sizeof(*v) can be called, which is much quicker.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to