You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/08/11 15:15:20 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #4685: Faster stream_get test

alamb commented on code in PR #4685:
URL: https://github.com/apache/arrow-rs/pull/4685#discussion_r1291472774


##########
object_store/src/lib.rs:
##########
@@ -1380,27 +1379,27 @@ mod tests {
         }
     }
 
-    fn get_random_bytes(len: usize) -> Bytes {
-        use rand::Rng;
-        let mut rng = rand::thread_rng();
-        let mut bytes = BytesMut::with_capacity(len);
-        for _ in 0..len {
-            bytes.put_u8(rng.gen());
+    /// Returns a chunk of length `chunk_length`
+    fn get_chunk(chunk_length: usize) -> Bytes {

Review Comment:
   I wonder if https://docs.rs/rand/latest/rand/trait.Rng.html#method.fill would result in the same performance improvement 🤔  



##########
object_store/src/lib.rs:
##########
@@ -1380,27 +1379,27 @@ mod tests {
         }
     }
 
-    fn get_random_bytes(len: usize) -> Bytes {
-        use rand::Rng;
-        let mut rng = rand::thread_rng();
-        let mut bytes = BytesMut::with_capacity(len);
-        for _ in 0..len {
-            bytes.put_u8(rng.gen());
+    /// Returns a chunk of length `chunk_length`
+    fn get_chunk(chunk_length: usize) -> Bytes {

Review Comment:
   I wonder if https://docs.rs/rand/latest/rand/trait.Rng.html#method.fill would result in the same performance improvement 🤔  



-- 
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-unsubscribe@arrow.apache.org

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