alamb commented on issue #6094:
URL: https://github.com/apache/arrow-rs/issues/6094#issuecomment-2239961332

   I recommend:
   1. We document some of the nuances with block size
   2. We add an API that lets the user pick between the simple / advanced 
strategy (as any particular API is unlikely to be optimal for the reasons you 
mention)
   
   For example, perhaps something like 
   ```rust
   enum GrowthStrategy {
     /// New buffers are allocated with the specified size, in bytes
     Fixed(usize),
     /// New buffers are allocated expotentially in size, until the max is hit
     /// For example, starting with 8K buffers, with a max of 2MB
     /// would allocate 8K -> 16K -> .... 2MB
     Exponential {
       starting_size: usize,
       max_size: usize 
     }
     // and you can imagine more sophisticated strategies eventually like 
UserDefined or something
   }
   
   impl StringViewBuilder {
     /// specify the growth strategy for buffers in this buffer
     fn with_buffer_allocation(mut self, strategy: GrowthStrategy) {
   ...
     }
   }
   ...
   ```
   
   I wonder if @a10y @AriesDevil or others have any thoughts 🤔 


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