richardstartin commented on PR #8464:
URL: https://github.com/apache/pinot/pull/8464#issuecomment-1087975492

   This appears to amount to a slight regression, at least it's in the noise, 
on a tiny baseline cost:
   
   ```java
   @State(Scope.Benchmark)
   public class OneElementList {
   
     @Param("*")
     String value;
   
     @Benchmark
     public List<String> singletonList() {
       return new ArrayList<>(Collections.singletonList(value));
     }
   
     @Benchmark
     public List<String> optimized() {
       List<String> list = new ArrayList<>(1);
       list.add(value);
       return list;
     }
   }
   ```
   
   ```
   Benchmark                     (value)  Mode  Cnt  Score   Error  Units
   OneElementList.optimized            *  avgt    5  6.138 ± 0.127  ns/op
   OneElementList.singletonList        *  avgt    5  5.224 ± 0.541  ns/op
   ```
   
   With the change 48 bytes is allocated per list, before it was 72 bytes. 
Maybe it's worthwhile for those 24 bytes.


-- 
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: commits-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to