pitrou commented on code in PR #49960:
URL: https://github.com/apache/arrow/pull/49960#discussion_r3225039392


##########
cpp/src/arrow/util/byte_stream_split_internal.h:
##########
@@ -421,14 +421,28 @@ void ByteStreamSplitEncodeScalar(const uint8_t* 
raw_values, int width,
   DoSplitStreams(raw_values, kNumStreams, num_values, dest_streams.data());
 }
 
+// If changing this value, please check that TestByteStreamSplitLargeWidth 
still
+// exercises the slow path.
+constexpr inline int kByteStreamSplitMaxTemporaryAlloc = 8192;
+
 inline void ByteStreamSplitEncodeScalarDynamic(const uint8_t* raw_values, int 
width,
                                                const int64_t num_values, 
uint8_t* out) {
-  ::arrow::internal::SmallVector<uint8_t*, 16> dest_streams;
-  dest_streams.resize(width);
-  for (int stream = 0; stream < width; ++stream) {
-    dest_streams[stream] = &out[stream * num_values];
+  if (ARROW_PREDICT_TRUE(width < kByteStreamSplitMaxTemporaryAlloc / 8)) {
+    ::arrow::internal::SmallVector<uint8_t*, 32> dest_streams;

Review Comment:
   Er... that's a good question. I probably thought it didn't hurt to bump it 
slightly, but then did not think about applying the same change to the decode 
routine. I'll make them consistent.



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