tustvold opened a new issue, #2054:
URL: https://github.com/apache/arrow-rs/issues/2054

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   The various builder constructors take capacities to pre-allocate. However, 
they aren't consistent about whether they take a capacity in terms of elements 
or bytes, or what these are capacities for.
   
   * PrimitiveBuilder::new - capacity in elements of T
   * BooleanBuilder::new - capacity in elements of bool
   * DecimalBuilder::new - capacity in terms of bytes
   * FixedSizeBinaryBuilder::new - capacity in terms of bytes
   * FixedSizeListBuilder::with_capacity - capacity in terms of list elements
   * GenericStringBuilder::new - capacity in terms of bytes of string data
   * GenericStringBuilder::with_capacity - capacity in terms of number of items 
and bytes of string data
   * MapBuilder::with_capacity - capacity in terms of number of items
   * UnionBuilder::with_capacity - capacity in terms of number of items
   
   **Describe the solution you'd like**
   
   I would like to propose the following:
   
   * Remove `capacity` from the `new` constructors, instead using a static 
default capacity (e.g. 1024)
   * Make `with_capacity` take capacities in terms of elements
   
   This has a couple of advantages:
   
   * Avoids subtly changing the meaning of parameters passed to pre-existing 
constructors
   * Brings the Builders closer into alignment with `Vec` (#1850)
   
   The only major disadvantage being that it results in API churn.
   
   **Describe alternatives you've considered**
   
   We could not do this, but the current situation leads to hard to spot 
performance bugs.
   
   **Additional context**
   
   Noticed whilst reviewing #2038 
   
   Thoughts @alamb @viirya @jhorstmann 
   


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

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

Reply via email to