ObserveOn throughput enhancements #2804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Squashed commits of #2773.
Further optimizations to
observeOn
.RingBuffer
to avoid the synchronization blockEventLoopsScheduler
which improves the sequential scheduling performance because a completing task's subscription will be most likely the first item in the underlying LinkedList.Benchmark: (i7 920, Window 7 x64, Java 1.8u31, 5x1s warmup, 5x5s iteration)
Notes:
size = 1
, the throughput varies in a +/- 3000 range on each run, and since the changes don't touch the scalar optimization, there is no real improvement there.size = 10.000
my system reached either the cache capacity or the OS scheduler's time resolution so there no improvement there on.size = 100.000
andsize = 1.000.000
the throughput doubles if I introduce some extra delay (i.e., via sleep(1) or some extra work).subscribeOn(1.000.000)
from 91 to 136.Since it conflicts with #2772 anyway, this is PR is to let others verify the optimizations actually work on other OSes, because on my Windows, I sometimes get significant variance in the throughput during iterations. Increased iteration time may be required as well.