softwaremill / jox

Fast and Scalable Channels in Java
Apache License 2.0
251 stars 8 forks source link

Cleanup send segments when closed, fix segment estimate in test #47

Closed adamw closed 8 months ago

adamw commented 8 months ago

Exemplified by the following test failure:

Channel(capacity=0, closed=true, sendSegment=5839, sendCounter=186929, receiveSegment=5841, receiveCounter=186933, bufferEndSegment=-1, bufferEndCounter=0): 
  Segment{id=5839, next=5840, prev=null, pointers=1, notProcessedAndInterrupted=6}: IR,IS,IS,IR,IR,IS,IS,IR,IR,IS,IR,IR,IS,IS,IS,IS,IS,B,IR,IR,B,B,B,B,B,IR,IR,IR,IR,IR,IR,IR
  Segment{id=5840, next=5841, prev=null, pointers=0, notProcessedAndInterrupted=7}: IR,IR,IR,IR,IR,IR,IR,B,B,B,B,IR,IR,IR,B,B,IR,B,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR
  Segment{id=5841, next=closed, prev=5840, pointers=1, notProcessedAndInterrupted=0}: IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,IR,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C
github-actions[bot] commented 8 months ago
Benchmark results ``` Java: (capacity) (chainLength) (parallelism) Mode Cnt Score Error Units BufferedBenchmark.arrayBlockingQueue 1 N/A N/A avgt 5 1008.787 ± 81.583 ns/op BufferedBenchmark.arrayBlockingQueue 10 N/A N/A avgt 5 215.615 ± 27.469 ns/op BufferedBenchmark.arrayBlockingQueue 100 N/A N/A avgt 5 114.682 ± 4.091 ns/op BufferedBenchmark.channel 1 N/A N/A avgt 5 211.274 ± 36.255 ns/op BufferedBenchmark.channel 10 N/A N/A avgt 5 174.660 ± 16.101 ns/op BufferedBenchmark.channel 100 N/A N/A avgt 5 151.800 ± 18.821 ns/op ChainedBenchmark.channelChain 0 10000 N/A avgt 5 1027.903 ± 24.575 ns/op ChainedBenchmark.channelChain 100 10000 N/A avgt 5 30.655 ± 2.296 ns/op ChainedBenchmark.queueChain 0 10000 N/A avgt 5 121.727 ± 18.291 ns/op ChainedBenchmark.queueChain 100 10000 N/A avgt 5 9.465 ± 0.293 ns/op ParallelBenchmark.parallelChannels 0 N/A 10000 avgt 5 1015.064 ± 22.182 ns/op ParallelBenchmark.parallelChannels 100 N/A 10000 avgt 5 37.290 ± 1.718 ns/op ParallelBenchmark.parallelQueues 0 N/A 10000 avgt 5 122.766 ± 61.381 ns/op ParallelBenchmark.parallelQueues 100 N/A 10000 avgt 5 12.982 ± 0.764 ns/op RendezvousBenchmark.channel N/A N/A N/A avgt 5 187.776 ± 22.244 ns/op RendezvousBenchmark.exchanger N/A N/A N/A avgt 5 91.113 ± 12.178 ns/op RendezvousBenchmark.synchronousQueue N/A N/A N/A avgt 5 577.305 ± 119.892 ns/op SelectBenchmark.selectWithSingleClause N/A N/A N/A avgt 5 217.129 ± 50.880 ns/op SelectBenchmark.selectWithTwoClauses N/A N/A N/A avgt 5 200.747 ± 22.032 ns/op Kotlin: (capacity) (chainLength) (parallelism) Mode Cnt Score Error Units BufferedKotlinBenchmark.channel_defaultDispatcher 1 N/A N/A avgt 5 107.065 ± 1.179 ns/op BufferedKotlinBenchmark.channel_defaultDispatcher 10 N/A N/A avgt 5 50.334 ± 0.474 ns/op BufferedKotlinBenchmark.channel_defaultDispatcher 100 N/A N/A avgt 5 32.368 ± 2.317 ns/op ChainedKotlinBenchmark.channelChain_defaultDispatcher 0 10000 N/A avgt 5 58.935 ± 1.516 ns/op ChainedKotlinBenchmark.channelChain_defaultDispatcher 100 10000 N/A avgt 5 15.441 ± 0.366 ns/op ChainedKotlinBenchmark.channelChain_eventLoop 0 10000 N/A avgt 5 96.272 ± 3.779 ns/op ChainedKotlinBenchmark.channelChain_eventLoop 100 10000 N/A avgt 5 30.779 ± 0.207 ns/op ParallelKotlinBenchmark.parallelChannels_defaultDispatcher 0 N/A 10000 avgt 5 168.081 ± 19.331 ns/op ParallelKotlinBenchmark.parallelChannels_defaultDispatcher 100 N/A 10000 avgt 5 15.414 ± 0.685 ns/op RendezvousKotlinBenchmark.channel_defaultDispatcher N/A N/A N/A avgt 5 140.183 ± 2.817 ns/op SelectKotlinBenchmark.selectWithSingleClause_defaultDispatcher N/A N/A N/A avgt 5 260.970 ± 1.593 ns/op SelectKotlinBenchmark.selectWithTwoClauses_defaultDispatcher N/A N/A N/A avgt 5 332.302 ± 12.124 ns/op ```
github-actions[bot] commented 8 months ago
Benchmark results ``` Java: (capacity) (chainLength) (parallelism) Mode Cnt Score Error Units BufferedBenchmark.arrayBlockingQueue 1 N/A N/A avgt 5 1131.264 ± 635.700 ns/op BufferedBenchmark.arrayBlockingQueue 10 N/A N/A avgt 5 193.326 ± 40.274 ns/op BufferedBenchmark.arrayBlockingQueue 100 N/A N/A avgt 5 120.016 ± 6.025 ns/op BufferedBenchmark.channel 1 N/A N/A avgt 5 203.000 ± 46.531 ns/op BufferedBenchmark.channel 10 N/A N/A avgt 5 173.794 ± 27.387 ns/op BufferedBenchmark.channel 100 N/A N/A avgt 5 136.446 ± 14.934 ns/op ChainedBenchmark.channelChain 0 10000 N/A avgt 5 1022.518 ± 14.922 ns/op ChainedBenchmark.channelChain 100 10000 N/A avgt 5 30.365 ± 1.368 ns/op ChainedBenchmark.queueChain 0 10000 N/A avgt 5 114.651 ± 21.796 ns/op ChainedBenchmark.queueChain 100 10000 N/A avgt 5 10.105 ± 0.319 ns/op ParallelBenchmark.parallelChannels 0 N/A 10000 avgt 5 1013.445 ± 12.045 ns/op ParallelBenchmark.parallelChannels 100 N/A 10000 avgt 5 37.492 ± 0.945 ns/op ParallelBenchmark.parallelQueues 0 N/A 10000 avgt 5 128.741 ± 38.186 ns/op ParallelBenchmark.parallelQueues 100 N/A 10000 avgt 5 13.095 ± 0.331 ns/op RendezvousBenchmark.channel N/A N/A N/A avgt 5 173.844 ± 25.225 ns/op RendezvousBenchmark.exchanger N/A N/A N/A avgt 5 87.809 ± 13.468 ns/op RendezvousBenchmark.synchronousQueue N/A N/A N/A avgt 5 548.803 ± 127.261 ns/op SelectBenchmark.selectWithSingleClause N/A N/A N/A avgt 5 214.635 ± 59.119 ns/op SelectBenchmark.selectWithTwoClauses N/A N/A N/A avgt 5 205.510 ± 18.567 ns/op Kotlin: (capacity) (chainLength) (parallelism) Mode Cnt Score Error Units BufferedKotlinBenchmark.channel_defaultDispatcher 1 N/A N/A avgt 5 113.070 ± 3.027 ns/op BufferedKotlinBenchmark.channel_defaultDispatcher 10 N/A N/A avgt 5 51.404 ± 2.923 ns/op BufferedKotlinBenchmark.channel_defaultDispatcher 100 N/A N/A avgt 5 33.342 ± 0.718 ns/op ChainedKotlinBenchmark.channelChain_defaultDispatcher 0 10000 N/A avgt 5 56.995 ± 1.319 ns/op ChainedKotlinBenchmark.channelChain_defaultDispatcher 100 10000 N/A avgt 5 15.285 ± 0.955 ns/op ChainedKotlinBenchmark.channelChain_eventLoop 0 10000 N/A avgt 5 101.547 ± 20.273 ns/op ChainedKotlinBenchmark.channelChain_eventLoop 100 10000 N/A avgt 5 33.628 ± 0.312 ns/op ParallelKotlinBenchmark.parallelChannels_defaultDispatcher 0 N/A 10000 avgt 5 79.833 ± 0.429 ns/op ParallelKotlinBenchmark.parallelChannels_defaultDispatcher 100 N/A 10000 avgt 5 16.269 ± 0.722 ns/op RendezvousKotlinBenchmark.channel_defaultDispatcher N/A N/A N/A avgt 5 187.729 ± 79.364 ns/op SelectKotlinBenchmark.selectWithSingleClause_defaultDispatcher N/A N/A N/A avgt 5 244.258 ± 36.957 ns/op SelectKotlinBenchmark.selectWithTwoClauses_defaultDispatcher N/A N/A N/A avgt 5 358.253 ± 7.976 ns/op ```