This is an automated email from the ASF dual-hosted git repository.

uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new f88949b  ARROW-2418: [Rust] BUG FIX: reserve memory when building list
f88949b is described below

commit f88949b7c04b834a2f397080cf18308698e6b5d6
Author: Andy Grove <andygrov...@gmail.com>
AuthorDate: Mon Apr 9 09:20:17 2018 +0200

    ARROW-2418: [Rust] BUG FIX: reserve memory when building list
    
    Author: Andy Grove <andygrov...@gmail.com>
    
    Closes #1857 from andygrove/list_reserve_mem and squashes the following 
commits:
    
    a2edda2 <Andy Grove> BUG FIX: reserve memory when building list
---
 rust/src/list.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rust/src/list.rs b/rust/src/list.rs
index 461f8e6..a7b11a6 100644
--- a/rust/src/list.rs
+++ b/rust/src/list.rs
@@ -44,7 +44,9 @@ impl From<Vec<String>> for List<u8> {
         let mut buf = BytesMut::with_capacity(v.len() * 32);
         offsets.push(0_i32);
         v.iter().for_each(|s| {
-            buf.put(s.as_bytes());
+            let slice = s.as_bytes();
+            buf.reserve(slice.len());
+            buf.put(slice);
             offsets.push(buf.len() as i32);
         });
         List {

-- 
To stop receiving notification emails like this one, please contact
u...@apache.org.

Reply via email to