Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Channel implement AutoCloseable #33

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Make Channel implement AutoCloseable #33

merged 1 commit into from
Jan 22, 2024

Conversation

adamw
Copy link
Member

@adamw adamw commented Jan 22, 2024

Closes #23

Copy link

Benchmark results
Java:
(capacity)  (chainLength)  Mode  Cnt     Score     Error  Units
BufferedBenchmark.arrayBlockingQueue             1            N/A  avgt    5  1017.007 ±  67.333  ns/op
BufferedBenchmark.arrayBlockingQueue            10            N/A  avgt    5   193.502 ±  33.597  ns/op
BufferedBenchmark.arrayBlockingQueue           100            N/A  avgt    5   116.331 ±   3.257  ns/op
BufferedBenchmark.channel                        1            N/A  avgt    5   216.174 ±  45.280  ns/op
BufferedBenchmark.channel                       10            N/A  avgt    5   185.888 ±  38.573  ns/op
BufferedBenchmark.channel                      100            N/A  avgt    5   156.230 ±  20.229  ns/op
ChainedBenchmark.channelChain                    0            100  avgt    5  1007.035 ±   4.340  ns/op
ChainedBenchmark.channelChain                    0           1000  avgt    5  1016.213 ±  17.392  ns/op
ChainedBenchmark.channelChain                    0          10000  avgt    5  1026.876 ±  16.654  ns/op
ChainedBenchmark.channelChain                  100            100  avgt    5    30.556 ±   0.654  ns/op
ChainedBenchmark.channelChain                  100           1000  avgt    5    30.479 ±   0.870  ns/op
ChainedBenchmark.channelChain                  100          10000  avgt    5    31.236 ±   1.589  ns/op
ChainedBenchmark.queueChain                      0            100  avgt    5   109.663 ±  12.628  ns/op
ChainedBenchmark.queueChain                      0           1000  avgt    5   125.174 ±  24.305  ns/op
ChainedBenchmark.queueChain                      0          10000  avgt    5   126.795 ±  38.346  ns/op
ChainedBenchmark.queueChain                    100            100  avgt    5    10.859 ±   0.638  ns/op
ChainedBenchmark.queueChain                    100           1000  avgt    5    11.017 ±   0.209  ns/op
ChainedBenchmark.queueChain                    100          10000  avgt    5     9.971 ±   0.575  ns/op
RendezvousBenchmark.channel                    N/A            N/A  avgt    5   174.572 ±  33.856  ns/op
RendezvousBenchmark.exchanger                  N/A            N/A  avgt    5    85.974 ±  15.187  ns/op
RendezvousBenchmark.synchronousQueue           N/A            N/A  avgt    5   604.921 ± 171.611  ns/op
SelectBenchmark.selectWithSingleClause         N/A            N/A  avgt    5   229.317 ±  63.647  ns/op
SelectBenchmark.selectWithTwoClauses           N/A            N/A  avgt    5   209.010 ±  17.063  ns/op

Kotlin:
(capacity)  (chainLength)  Mode  Cnt    Score     Error  Units
BufferedKotlinBenchmark.channel_defaultDispatcher                        1            N/A  avgt    5  106.512 ±   1.161  ns/op
BufferedKotlinBenchmark.channel_defaultDispatcher                       10            N/A  avgt    5   54.214 ±   0.777  ns/op
BufferedKotlinBenchmark.channel_defaultDispatcher                      100            N/A  avgt    5   32.508 ±   0.719  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                    0            100  avgt    5   73.906 ±   3.939  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                    0           1000  avgt    5  114.053 ± 124.448  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                    0          10000  avgt    5   58.353 ±   4.273  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                  100            100  avgt    5   13.970 ±   0.975  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                  100           1000  avgt    5   13.848 ±   0.396  ns/op
ChainedKotlinBenchmark.channelChain_defaultDispatcher                  100          10000  avgt    5   15.135 ±   0.502  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                            0            100  avgt    5  102.354 ±   7.999  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                            0           1000  avgt    5  155.914 ±  15.449  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                            0          10000  avgt    5   94.958 ±   1.334  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                          100            100  avgt    5   29.260 ±   0.229  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                          100           1000  avgt    5   31.472 ±   0.191  ns/op
ChainedKotlinBenchmark.channelChain_eventLoop                          100          10000  avgt    5   31.386 ±   0.748  ns/op
RendezvousKotlinBenchmark.channel_defaultDispatcher                    N/A            N/A  avgt    5  148.933 ±   0.661  ns/op
SelectKotlinBenchmark.selectWithSingleClause_defaultDispatcher         N/A            N/A  avgt    5  249.941 ±  14.974  ns/op
SelectKotlinBenchmark.selectWithTwoClauses_defaultDispatcher           N/A            N/A  avgt    5  312.930 ±   1.185  ns/op

@adamw adamw merged commit 3160b8f into main Jan 22, 2024
4 checks passed
@adamw adamw deleted the autocloseable branch January 22, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider renaming done() to close() and implementing AutoCloseable
1 participant