Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1144#discussion_r179022533
  
    --- Diff: exec/vector/src/main/codegen/templates/VariableLengthVectors.java 
---
    @@ -534,15 +534,11 @@ public void setSafe(int index, byte[] bytes) {
           assert index >= 0;
     
           final int currentOffset = offsetVector.getAccessor().get(index);
    -      offsetVector.getMutator().setSafe(index + 1, currentOffset + 
bytes.length);
    -      try {
    -        data.setBytes(currentOffset, bytes, 0, bytes.length);
    -      } catch (IndexOutOfBoundsException e) {
    -        while (data.capacity() < currentOffset + bytes.length) {
    -          reAlloc();
    -        }
    -        data.setBytes(currentOffset, bytes, 0, bytes.length);
    +      while (data.capacity() < currentOffset + bytes.length) {
    --- End diff --
    
    One trick used in the row set reader code is to avoid redundant re-allocs 
by computing the new size and rounding to a power of two. This is handy at the 
start with the vector doubles from 256 to 512 to 1K and the data size is, say, 
600 bytes.
    
    However, it is not clear that such an optimization is as necessary as it 
once was: the team's been doing a good job at adding up-front vector allocation 
where it was missing, reducing the gratuitous reallocs.


---

Reply via email to