dcapwell commented on PR #17:
URL: https://github.com/apache/cassandra-accord/pull/17#issuecomment-1360658434

   In my feedback branch I pushed JMH benchmarks for result.map vs chain.map, I 
re-structured the output to be easier to read (group by chainSize rather than 
benchmark).
   
   ```
   Benchmark                   (chainSize)  Mode  Cnt   Score   Error  Units
   AsyncChainBenchmark.chain             1  avgt       19.267          ns/op
   AsyncChainBenchmark.result            1  avgt       13.028          ns/op
   
   AsyncChainBenchmark.chain             2  avgt       24.885          ns/op
   AsyncChainBenchmark.result            2  avgt       24.677          ns/op
   
   AsyncChainBenchmark.chain             3  avgt       26.092          ns/op
   AsyncChainBenchmark.result            3  avgt       36.276          ns/op
   
   AsyncChainBenchmark.chain             4  avgt       30.516          ns/op
   AsyncChainBenchmark.result            4  avgt       47.993          ns/op
   
   AsyncChainBenchmark.chain             5  avgt       36.291          ns/op
   AsyncChainBenchmark.result            5  avgt       60.386          ns/op
   ```
   
   `chain` starts to win after 3 hops
   
   I did the same for `flatMap`, but made the assumption that the source of 
async will produce a `AsyncResult` (which is true in the Cassandra branch)
   
   ```
   Benchmark                          (chainSize)  Mode  Cnt    Score   Error  
Units
   AsyncChainBenchmark.chainFlatMap             1  avgt        33.366          
ns/op
   AsyncChainBenchmark.resultFlatMap            1  avgt        25.701          
ns/op
   
   AsyncChainBenchmark.chainFlatMap             2  avgt        56.366          
ns/op
   AsyncChainBenchmark.resultFlatMap            2  avgt        51.788          
ns/op
   
   AsyncChainBenchmark.chainFlatMap             3  avgt        70.098          
ns/op
   AsyncChainBenchmark.resultFlatMap            3  avgt        78.100          
ns/op
   
   AsyncChainBenchmark.chainFlatMap             4  avgt        96.927          
ns/op
   AsyncChainBenchmark.resultFlatMap            4  avgt       104.856          
ns/op
   
   AsyncChainBenchmark.chainFlatMap             5  avgt       111.148          
ns/op
   AsyncChainBenchmark.resultFlatMap            5  avgt       133.539          
ns/op
   ```
   
   Given the assumption above, the fact that both models are the same makes 
sense, as you can not build a chain with `flatMap` (you are producing results 
with a single hop)


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to