XiangpengHao commented on code in PR #5922:
URL: https://github.com/apache/arrow-rs/pull/5922#discussion_r1650115227


##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -238,8 +241,18 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
     }
 
     /// Returns the element at index `i`
+    ///
+    ///
     /// # Safety
     /// Caller is responsible for ensuring that the index is within the bounds 
of the array
+    // 
+    // This function can't be inlined, ow it causes the caller function to run 
out of registers and cause register spilling.
+    // Basically you can't just call `l_full_data = left.value_unchecked(...)`,
+    // the compiler tries to inline the `value_unchecked` function, which 
introduces many unnecessary variables on stack.
+    // Looking at the assembly, the auto-inlined version run out of the 
registers, which causes register spilling, which then causes unnecessary memory 
access.
+    //
+    // TLDR: don't change it, unless you have examined the assembly output.

Review Comment:
   Agree.. Strangely, after I move the comparison to `arrow-ord`, we no longer 
need to force inline(never)... So I removed these comments..



-- 
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]

Reply via email to