alamb commented on code in PR #21863:
URL: https://github.com/apache/datafusion/pull/21863#discussion_r3147932453


##########
datafusion/functions/src/strings.rs:
##########
@@ -604,7 +604,17 @@ impl StringViewArrayBuilder {
         let offset: u32 = i32::try_from(self.in_progress.len())
             .expect("offset exceeds i32::MAX") as u32;
         self.in_progress.extend_from_slice(v);
-        self.views.push(make_view(v, buffer_index, offset));
+
+        // Build the ByteView inline rather than going through `make_view`,
+        // which is marked as `[inline(never)]`.
+        let view = ByteView {
+            length,
+            // SAFETY: length > 12 here, so v has at least 4 bytes.

Review Comment:
   FWIW there is no safety implication here (as the code below uses unwrap() 
rather than `unsafe`)



##########
datafusion/functions/src/strings.rs:
##########
@@ -604,7 +604,17 @@ impl StringViewArrayBuilder {
         let offset: u32 = i32::try_from(self.in_progress.len())
             .expect("offset exceeds i32::MAX") as u32;
         self.in_progress.extend_from_slice(v);
-        self.views.push(make_view(v, buffer_index, offset));
+
+        // Build the ByteView inline rather than going through `make_view`,

Review Comment:
   This might be worth a mention upstream in the docs -- I reacall this isn't 
inlined because for some really tight inner loops is messed up vectorization or 
something
   
   But in general inlining probably helps (like maybe we should provide a 
version of `make_view` that is inlineable 🤔 )



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to