rmannibucau commented on PR #118:
URL: https://github.com/apache/openjpa/pull/118#issuecomment-2289391258

   @solomax globally looks good to give an idea except a small detail: it tests 
arraylist which is not used instead of array of strings (`String[]` - arrays 
not using iterators are faster in general).
   
   I modified the bench to add this test and here is my raw result:
   
   ```
   Benchmark          Mode  Cnt  Score   Error  Units
   App.testArray      avgt    2  0.022          ms/op
   App.testArrayList  avgt    2  0.030          ms/op
   App.testSet        avgt    2  0.022          ms/op
   ```
   
   (which is close to what you had for the overlapping part except you have a 
better computer ;)).
   
   What is interesting is that the set is "hot" faster by design where the 
array string needs some cycles (JIT) - but not sure it is critical since 
normally the blacklist is small and whitelist open.
   
   What is sure is that `ArrayList` is a poor fit there - even if I'm not 
convinced that when it is used - serialization - it will be noticed.
   
   Reran with mode details - in particular the ops/sec instead of avg - here is 
what I'm getting:
   
   ```
   Benchmark                    Mode       Cnt     Score   Error   Units
   App.testArray               thrpt         2  1204.234          ops/ms
   App.testArrayList           thrpt         2   855.284          ops/ms
   App.testSet                 thrpt         2  1357.010          ops/ms
   App.testArray                avgt         2     0.026           ms/op
   App.testArrayList            avgt         2     0.036           ms/op
   App.testSet                  avgt         2     0.024           ms/op
   App.testArray              sample   9660334     0.030 � 0.001   ms/op
   App.testArray:p0.00        sample               0.006           ms/op
   App.testArray:p0.50        sample               0.012           ms/op
   App.testArray:p0.90        sample               0.012           ms/op
   App.testArray:p0.95        sample               0.012           ms/op
   App.testArray:p0.99        sample               0.012           ms/op
   App.testArray:p0.999       sample               0.157           ms/op
   App.testArray:p0.9999      sample              46.334           ms/op
   App.testArray:p1.00        sample              87.032           ms/op
   App.testArrayList          sample   7826638     0.038 � 0.001   ms/op
   App.testArrayList:p0.00    sample               0.007           ms/op
   App.testArrayList:p0.50    sample               0.014           ms/op
   App.testArrayList:p0.90    sample               0.014           ms/op
   App.testArrayList:p0.95    sample               0.014           ms/op
   App.testArrayList:p0.99    sample               0.016           ms/op
   App.testArrayList:p0.999   sample               0.294           ms/op
   App.testArrayList:p0.9999  sample              46.072           ms/op
   App.testArrayList:p1.00    sample             118.358           ms/op
   App.testSet                sample  12102463     0.023 � 0.001   ms/op
   App.testSet:p0.00          sample               0.008           ms/op
   App.testSet:p0.50          sample               0.009           ms/op
   App.testSet:p0.90          sample               0.010           ms/op
   App.testSet:p0.95          sample               0.010           ms/op
   App.testSet:p0.99          sample               0.010           ms/op
   App.testSet:p0.999         sample               0.087           ms/op
   App.testSet:p0.9999        sample              43.450           ms/op
   App.testSet:p1.00          sample             115.737           ms/op
   App.testArray                  ss         2     0.739           ms/op
   App.testArrayList              ss         2     2.620           ms/op
   App.testSet                    ss         2     0.120           ms/op
   ```
   
   So overall I'm not sure of the improvement in terms of speed nor usage - 
which would need to have stats about the ratio between primitives and custom 
classes, we can probably assume the primitives are numerous - if we include 
String as a primitive indeed - but I'm less convinced about arrays there. Keep 
in mind that even if we use a set for known types and add configuration to drop 
them from the default "known" set, we still need to iterate for other types so 
the speed of the set will be mitigated a bit and the small remaining distance 
with a plain array will be reduced so overall I think the compromise in terms 
of speed and code simplicity is not that bad with a plain array.
   
   Wdyt?


-- 
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: dev-unsubscr...@openjpa.apache.org

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

Reply via email to