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

Add support for Thread.onSpinWait() while spinning #284

Open
franz1981 opened this issue Jan 4, 2020 · 1 comment
Open

Add support for Thread.onSpinWait() while spinning #284

franz1981 opened this issue Jan 4, 2020 · 1 comment

Comments

@franz1981
Copy link
Collaborator

It wides the scope of #147, using it on queues by reusing the ideas on https://github.com/giltene/GilExamples/tree/master/SpinWaitTest/src/main/java/org/performancehints to provide support while retaining Java 6 compatibility.

franz1981 added a commit to franz1981/JCTools that referenced this issue Jan 4, 2020
franz1981 added a commit to franz1981/JCTools that referenced this issue Jan 4, 2020
franz1981 added a commit to franz1981/JCTools that referenced this issue Jan 9, 2020
@franz1981
Copy link
Collaborator Author

franz1981 commented Jan 9, 2020

Just for the records, I've run a couple of benchmarks using onSpinWait using this branch :

6P-6C (4 chunks of 256 elements):

Benchmark                                         (burstSize)  (chunkSize)  (consumerCount)  (onSpinWait)  (pooledChunks)  (qCapacity)                      (qType)  (warmup)  Mode  Cnt       Score       Error   Units
XaddQueueBurstCost.burstCost                              100          256                6          true               4         1024  MpmcUnboundedXaddArrayQueue      true  avgt   30  183017.519 ± 10334.573   ns/op
XaddQueueBurstCost.burstCost                              100          256                6         false               4         1024  MpmcUnboundedXaddArrayQueue      true  avgt   30  191742.466 ± 13786.168   ns/op

10P-1C (6 chunks of 256 elements):

Benchmark                                         (burstSize)  (chunkSize)  (consumerCount)  (onSpinWait)  (pooledChunks)  (qCapacity)                      (qType)  (warmup)  Mode  Cnt      Score      Error   Units
XaddQueueBurstCost.burstCost                              100          256                1          true               5       132000  MpscUnboundedXaddArrayQueue      true  avgt   30  51946.455 ±  978.654   ns/op
XaddQueueBurstCost.burstCost                              100          256                1          true               5       132000  MpmcUnboundedXaddArrayQueue      true  avgt   30  65129.730 ± 1625.001   ns/op
XaddQueueBurstCost.burstCost                              100          256                1         false               5       132000  MpscUnboundedXaddArrayQueue      true  avgt   30  53812.430 ± 1962.361   ns/op
XaddQueueBurstCost.burstCost                              100          256                1         false               5       132000  MpmcUnboundedXaddArrayQueue      true  avgt   30  69046.787 ± 3327.661   ns/op

with 1024 elements (as a reference, no onSpinWait here):

Benchmark                                         (burstSize)  (chunkSize)  (consumerCount)  (onSpinWait)  (pooledChunks)  (qCapacity)                  (qType)  (warmup)  Mode  Cnt       Score      Error   Units
XaddQueueBurstCost.burstCost                              100          256                1         false               4         1024  MpscUnboundedArrayQueue      true  avgt   30  233283.374 ± 2846.983   ns/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants