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 select clauses immutable & reusable #26

Merged
merged 7 commits into from
Jan 4, 2024
Merged

Make select clauses immutable & reusable #26

merged 7 commits into from
Jan 4, 2024

Conversation

adamw
Copy link
Member

@adamw adamw commented Jan 4, 2024

No description provided.

Copy link

github-actions bot commented Jan 4, 2024

Benchmark results
Java:
(capacity)  Mode  Cnt     Score     Error  Units
BufferedBenchmark.array_blocking_queue                                      1  avgt   15  1170.449 ± 103.682  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue              1  avgt   15  1170.446 ± 103.676  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue           1  avgt   15  1170.452 ± 103.688  ns/op
BufferedBenchmark.array_blocking_queue                                     10  avgt   15   256.241 ±  27.367  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue             10  avgt   15   256.241 ±  27.368  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue          10  avgt   15   256.241 ±  27.367  ns/op
BufferedBenchmark.array_blocking_queue                                    100  avgt   15   150.664 ±  13.327  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue            100  avgt   15   150.664 ±  13.327  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue         100  avgt   15   150.663 ±  13.327  ns/op
BufferedBenchmark.channel                                                   1  avgt   15   205.311 ±  19.969  ns/op
BufferedBenchmark.channel:receiveFromChannel                                1  avgt   15   205.312 ±  19.968  ns/op
BufferedBenchmark.channel:sendToChannel                                     1  avgt   15   205.309 ±  19.970  ns/op
BufferedBenchmark.channel                                                  10  avgt   15   178.548 ±   3.151  ns/op
BufferedBenchmark.channel:receiveFromChannel                               10  avgt   15   178.547 ±   3.149  ns/op
BufferedBenchmark.channel:sendToChannel                                    10  avgt   15   178.549 ±   3.154  ns/op
BufferedBenchmark.channel                                                 100  avgt   15   129.613 ±  12.288  ns/op
BufferedBenchmark.channel:receiveFromChannel                              100  avgt   15   129.613 ±  12.288  ns/op
BufferedBenchmark.channel:sendToChannel                                   100  avgt   15   129.612 ±  12.288  ns/op
BufferedBenchmark.channel_iterative                                         1  avgt   15   205.835 ±   6.232  ns/op
BufferedBenchmark.channel_iterative                                        10  avgt   15   175.220 ±  14.804  ns/op
BufferedBenchmark.channel_iterative                                       100  avgt   15   154.763 ±  11.936  ns/op
RendezvousBenchmark.channel                                               N/A  avgt   15   200.097 ±   6.871  ns/op
RendezvousBenchmark.channel:receiveFromChannel                            N/A  avgt   15   200.099 ±   6.873  ns/op
RendezvousBenchmark.channel:sendToChannel                                 N/A  avgt   15   200.096 ±   6.870  ns/op
RendezvousBenchmark.channel_iterative                                     N/A  avgt   15   190.639 ±   8.338  ns/op
RendezvousBenchmark.exchanger                                             N/A  avgt   15    96.154 ±  11.704  ns/op
RendezvousBenchmark.exchanger:exchange1                                   N/A  avgt   15    96.155 ±  11.704  ns/op
RendezvousBenchmark.exchanger:exchange2                                   N/A  avgt   15    96.154 ±  11.704  ns/op
RendezvousBenchmark.synchronous_queue                                     N/A  avgt   15   200.224 ±   4.402  ns/op
RendezvousBenchmark.synchronous_queue:putToSynchronousQueue               N/A  avgt   15   200.227 ±   4.403  ns/op
RendezvousBenchmark.synchronous_queue:takeFromSynchronousQueue            N/A  avgt   15   200.221 ±   4.401  ns/op
SelectBenchmark.channel                                                   N/A  avgt   15   225.159 ±  12.713  ns/op
SelectBenchmark.channel:receiveFromChannelUsingSelect                     N/A  avgt   15   225.157 ±  12.710  ns/op
SelectBenchmark.channel:sendToChannel                                     N/A  avgt   15   225.161 ±  12.715  ns/op
SelectBenchmark.single_channel_iterative                                  N/A  avgt   15   211.024 ±   5.480  ns/op
SelectBenchmark.two_channels_iterative                                    N/A  avgt   15   276.657 ±  80.351  ns/op

Kotlin:
(capacity)  Mode  Cnt    Score    Error  Units
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                              1  avgt   15  115.051 ±  1.435  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                             10  avgt   15   51.961 ±  2.127  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                            100  avgt   15   32.660 ±  0.611  ns/op
RendezvousKotlinBenchmark.sendReceiveUsingDefaultDispatcher                          N/A  avgt   15  139.583 ±  3.716  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_singleChannel_defaultDispatcher         N/A  avgt   15  251.729 ± 13.055  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_twoChannels_defaultDispatcher           N/A  avgt   15  342.756 ±  6.875  ns/op

Copy link

github-actions bot commented Jan 4, 2024

Benchmark results
Java:
(capacity)  Mode  Cnt     Score     Error  Units
BufferedBenchmark.array_blocking_queue                                      1  avgt   15  1199.640 ±  79.805  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue              1  avgt   15  1199.639 ±  79.798  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue           1  avgt   15  1199.642 ±  79.812  ns/op
BufferedBenchmark.array_blocking_queue                                     10  avgt   15   254.342 ±  29.781  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue             10  avgt   15   254.340 ±  29.780  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue          10  avgt   15   254.344 ±  29.782  ns/op
BufferedBenchmark.array_blocking_queue                                    100  avgt   15   159.088 ±  24.537  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue            100  avgt   15   159.088 ±  24.537  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue         100  avgt   15   159.088 ±  24.537  ns/op
BufferedBenchmark.channel                                                   1  avgt   15   206.329 ±  20.563  ns/op
BufferedBenchmark.channel:receiveFromChannel                                1  avgt   15   206.329 ±  20.562  ns/op
BufferedBenchmark.channel:sendToChannel                                     1  avgt   15   206.328 ±  20.565  ns/op
BufferedBenchmark.channel                                                  10  avgt   15   191.038 ±  18.043  ns/op
BufferedBenchmark.channel:receiveFromChannel                               10  avgt   15   191.038 ±  18.044  ns/op
BufferedBenchmark.channel:sendToChannel                                    10  avgt   15   191.039 ±  18.042  ns/op
BufferedBenchmark.channel                                                 100  avgt   15   143.407 ±  13.851  ns/op
BufferedBenchmark.channel:receiveFromChannel                              100  avgt   15   143.408 ±  13.853  ns/op
BufferedBenchmark.channel:sendToChannel                                   100  avgt   15   143.406 ±  13.849  ns/op
BufferedBenchmark.channel_iterative                                         1  avgt   15   210.865 ±  21.906  ns/op
BufferedBenchmark.channel_iterative                                        10  avgt   15   183.086 ±   6.750  ns/op
BufferedBenchmark.channel_iterative                                       100  avgt   15   142.045 ±  11.678  ns/op
RendezvousBenchmark.channel                                               N/A  avgt   15   191.237 ±   8.357  ns/op
RendezvousBenchmark.channel:receiveFromChannel                            N/A  avgt   15   191.237 ±   8.357  ns/op
RendezvousBenchmark.channel:sendToChannel                                 N/A  avgt   15   191.236 ±   8.357  ns/op
RendezvousBenchmark.channel_iterative                                     N/A  avgt   15   178.253 ±   3.988  ns/op
RendezvousBenchmark.exchanger                                             N/A  avgt   15    97.263 ±   4.309  ns/op
RendezvousBenchmark.exchanger:exchange1                                   N/A  avgt   15    97.263 ±   4.309  ns/op
RendezvousBenchmark.exchanger:exchange2                                   N/A  avgt   15    97.263 ±   4.309  ns/op
RendezvousBenchmark.synchronous_queue                                     N/A  avgt   15   199.296 ±   5.961  ns/op
RendezvousBenchmark.synchronous_queue:putToSynchronousQueue               N/A  avgt   15   199.298 ±   5.958  ns/op
RendezvousBenchmark.synchronous_queue:takeFromSynchronousQueue            N/A  avgt   15   199.295 ±   5.963  ns/op
SelectBenchmark.channel                                                   N/A  avgt   15   237.223 ±  22.511  ns/op
SelectBenchmark.channel:receiveFromChannelUsingSelect                     N/A  avgt   15   237.223 ±  22.511  ns/op
SelectBenchmark.channel:sendToChannel                                     N/A  avgt   15   237.223 ±  22.512  ns/op
SelectBenchmark.single_channel_iterative                                  N/A  avgt   15   288.786 ± 112.148  ns/op
SelectBenchmark.two_channels_iterative                                    N/A  avgt   15   256.288 ±  55.384  ns/op

Kotlin:
(capacity)  Mode  Cnt    Score    Error  Units
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                              1  avgt   15  112.185 ±  3.251  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                             10  avgt   15   51.393 ±  0.565  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                            100  avgt   15   32.280 ±  0.189  ns/op
RendezvousKotlinBenchmark.sendReceiveUsingDefaultDispatcher                          N/A  avgt   15  141.080 ±  2.442  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_singleChannel_defaultDispatcher         N/A  avgt   15  255.359 ± 11.081  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_twoChannels_defaultDispatcher           N/A  avgt   15  343.677 ±  7.766  ns/op

Copy link

github-actions bot commented Jan 4, 2024

Benchmark results
Java:
(capacity)  Mode  Cnt     Score     Error  Units
BufferedBenchmark.array_blocking_queue                                      1  avgt   15  1204.967 ± 113.360  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue              1  avgt   15  1204.970 ± 113.360  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue           1  avgt   15  1204.964 ± 113.359  ns/op
BufferedBenchmark.array_blocking_queue                                     10  avgt   15   246.430 ±  10.020  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue             10  avgt   15   246.430 ±  10.020  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue          10  avgt   15   246.430 ±  10.020  ns/op
BufferedBenchmark.array_blocking_queue                                    100  avgt   15   152.950 ±  16.622  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue            100  avgt   15   152.950 ±  16.623  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue         100  avgt   15   152.951 ±  16.621  ns/op
BufferedBenchmark.channel                                                   1  avgt   15   213.118 ±   7.178  ns/op
BufferedBenchmark.channel:receiveFromChannel                                1  avgt   15   213.118 ±   7.178  ns/op
BufferedBenchmark.channel:sendToChannel                                     1  avgt   15   213.118 ±   7.179  ns/op
BufferedBenchmark.channel                                                  10  avgt   15   168.066 ±   4.904  ns/op
BufferedBenchmark.channel:receiveFromChannel                               10  avgt   15   168.065 ±   4.900  ns/op
BufferedBenchmark.channel:sendToChannel                                    10  avgt   15   168.068 ±   4.908  ns/op
BufferedBenchmark.channel                                                 100  avgt   15   154.515 ±  20.020  ns/op
BufferedBenchmark.channel:receiveFromChannel                              100  avgt   15   154.516 ±  20.020  ns/op
BufferedBenchmark.channel:sendToChannel                                   100  avgt   15   154.513 ±  20.019  ns/op
BufferedBenchmark.channel_iterative                                         1  avgt   15   213.861 ±   7.074  ns/op
BufferedBenchmark.channel_iterative                                        10  avgt   15   167.270 ±  13.214  ns/op
BufferedBenchmark.channel_iterative                                       100  avgt   15   139.160 ±   7.208  ns/op
RendezvousBenchmark.channel                                               N/A  avgt   15   189.036 ±   5.376  ns/op
RendezvousBenchmark.channel:receiveFromChannel                            N/A  avgt   15   189.039 ±   5.375  ns/op
RendezvousBenchmark.channel:sendToChannel                                 N/A  avgt   15   189.033 ±   5.376  ns/op
RendezvousBenchmark.channel_iterative                                     N/A  avgt   15   180.717 ±  16.465  ns/op
RendezvousBenchmark.exchanger                                             N/A  avgt   15    91.003 ±   4.682  ns/op
RendezvousBenchmark.exchanger:exchange1                                   N/A  avgt   15    91.003 ±   4.682  ns/op
RendezvousBenchmark.exchanger:exchange2                                   N/A  avgt   15    91.002 ±   4.682  ns/op
RendezvousBenchmark.synchronous_queue                                     N/A  avgt   15   212.152 ±  16.565  ns/op
RendezvousBenchmark.synchronous_queue:putToSynchronousQueue               N/A  avgt   15   212.153 ±  16.566  ns/op
RendezvousBenchmark.synchronous_queue:takeFromSynchronousQueue            N/A  avgt   15   212.150 ±  16.564  ns/op
SelectBenchmark.channel                                                   N/A  avgt   15   234.410 ±  15.478  ns/op
SelectBenchmark.channel:receiveFromChannelUsingSelect                     N/A  avgt   15   234.409 ±  15.475  ns/op
SelectBenchmark.channel:sendToChannel                                     N/A  avgt   15   234.410 ±  15.480  ns/op
SelectBenchmark.single_channel_iterative                                  N/A  avgt   15   227.181 ±  32.145  ns/op
SelectBenchmark.two_channels_iterative                                    N/A  avgt   15   276.435 ±  90.722  ns/op

Kotlin:
(capacity)  Mode  Cnt    Score    Error  Units
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                              1  avgt   15  111.802 ±  3.394  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                             10  avgt   15   52.047 ±  0.857  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                            100  avgt   15   31.065 ±  1.653  ns/op
RendezvousKotlinBenchmark.sendReceiveUsingDefaultDispatcher                          N/A  avgt   15  141.746 ±  2.140  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_singleChannel_defaultDispatcher         N/A  avgt   15  244.794 ±  5.056  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_twoChannels_defaultDispatcher           N/A  avgt   15  335.380 ± 27.743  ns/op

@adamw adamw merged commit 00712c2 into main Jan 4, 2024
4 checks passed
@adamw adamw deleted the immutable-clauses branch January 4, 2024 20:55
Copy link

github-actions bot commented Jan 4, 2024

Benchmark results
Java:
(capacity)  Mode  Cnt     Score     Error  Units
BufferedBenchmark.array_blocking_queue                                      1  avgt   15  1269.642 ± 205.154  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue              1  avgt   15  1269.640 ± 205.161  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue           1  avgt   15  1269.644 ± 205.147  ns/op
BufferedBenchmark.array_blocking_queue                                     10  avgt   15   241.732 ±  26.659  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue             10  avgt   15   241.734 ±  26.658  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue          10  avgt   15   241.731 ±  26.660  ns/op
BufferedBenchmark.array_blocking_queue                                    100  avgt   15   140.958 ±  14.657  ns/op
BufferedBenchmark.array_blocking_queue:putToArrayBlockingQueue            100  avgt   15   140.959 ±  14.657  ns/op
BufferedBenchmark.array_blocking_queue:takeFromArrayBlockingQueue         100  avgt   15   140.958 ±  14.657  ns/op
BufferedBenchmark.channel                                                   1  avgt   15   209.040 ±  16.868  ns/op
BufferedBenchmark.channel:receiveFromChannel                                1  avgt   15   209.039 ±  16.873  ns/op
BufferedBenchmark.channel:sendToChannel                                     1  avgt   15   209.042 ±  16.864  ns/op
BufferedBenchmark.channel                                                  10  avgt   15   183.844 ±  12.020  ns/op
BufferedBenchmark.channel:receiveFromChannel                               10  avgt   15   183.844 ±  12.020  ns/op
BufferedBenchmark.channel:sendToChannel                                    10  avgt   15   183.845 ±  12.019  ns/op
BufferedBenchmark.channel                                                 100  avgt   15   144.612 ±   8.134  ns/op
BufferedBenchmark.channel:receiveFromChannel                              100  avgt   15   144.614 ±   8.135  ns/op
BufferedBenchmark.channel:sendToChannel                                   100  avgt   15   144.611 ±   8.133  ns/op
BufferedBenchmark.channel_iterative                                         1  avgt   15   206.905 ±   7.666  ns/op
BufferedBenchmark.channel_iterative                                        10  avgt   15   177.156 ±  11.658  ns/op
BufferedBenchmark.channel_iterative                                       100  avgt   15   140.200 ±  21.748  ns/op
RendezvousBenchmark.channel                                               N/A  avgt   15   183.684 ±   5.883  ns/op
RendezvousBenchmark.channel:receiveFromChannel                            N/A  avgt   15   183.682 ±   5.884  ns/op
RendezvousBenchmark.channel:sendToChannel                                 N/A  avgt   15   183.686 ±   5.882  ns/op
RendezvousBenchmark.channel_iterative                                     N/A  avgt   15   174.262 ±   5.034  ns/op
RendezvousBenchmark.exchanger                                             N/A  avgt   15   102.342 ±   9.783  ns/op
RendezvousBenchmark.exchanger:exchange1                                   N/A  avgt   15   102.342 ±   9.782  ns/op
RendezvousBenchmark.exchanger:exchange2                                   N/A  avgt   15   102.342 ±   9.783  ns/op
RendezvousBenchmark.synchronous_queue                                     N/A  avgt   15   202.496 ±   6.416  ns/op
RendezvousBenchmark.synchronous_queue:putToSynchronousQueue               N/A  avgt   15   202.500 ±   6.417  ns/op
RendezvousBenchmark.synchronous_queue:takeFromSynchronousQueue            N/A  avgt   15   202.493 ±   6.415  ns/op
SelectBenchmark.channel                                                   N/A  avgt   15   210.971 ±  12.820  ns/op
SelectBenchmark.channel:receiveFromChannelUsingSelect                     N/A  avgt   15   210.970 ±  12.820  ns/op
SelectBenchmark.channel:sendToChannel                                     N/A  avgt   15   210.972 ±  12.820  ns/op
SelectBenchmark.single_channel_iterative                                  N/A  avgt   15   252.265 ±  26.268  ns/op
SelectBenchmark.two_channels_iterative                                    N/A  avgt   15   209.084 ±   9.557  ns/op

Kotlin:
(capacity)  Mode  Cnt    Score    Error  Units
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                              1  avgt   15  117.225 ± 15.285  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                             10  avgt   15   52.250 ±  0.989  ns/op
BufferedKotlinBenchmark.sendReceiveUsingDefaultDispatcher                            100  avgt   15   32.446 ±  0.295  ns/op
RendezvousKotlinBenchmark.sendReceiveUsingDefaultDispatcher                          N/A  avgt   15  140.298 ±  1.516  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_singleChannel_defaultDispatcher         N/A  avgt   15  258.361 ±  4.780  ns/op
SelectKotlinBenchmark.sendReceiveUsingSelect_twoChannels_defaultDispatcher           N/A  avgt   15  345.787 ± 18.595  ns/op

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.

1 participant