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

Optimized scalar observeOn/subscribeOn #2767

Merged
merged 1 commit into from
Feb 24, 2015

Conversation

akarnokd
Copy link
Member

Redone #2603.

Run on i7 920, 2.6GHz, Windows 7 x64, JDK 1.8u31

Benchmark      (size)       this   Score error       1.x   Score error
observeOn           1  160377,408     3091,205  140913,081     7097,415
observeOn          10  132990,049     1477,661  125288,149    14304,259
observeOn         100   43701,203     2342,570   43840,921      944,682
observeOn        1000   11603,952     2377,205   11400,340     1400,628
observeOn        2000    6769,716      220,476    6853,283       71,276
observeOn        3000    4753,876      326,497    4741,108      120,612
observeOn        4000    3616,782      212,285    3632,433      433,754
observeOn       10000    1544,141       28,796    1548,504       61,419
observeOn      100000     149,573       14,974     150,924        8,331
observeOn     1000000      14,909        2,079      13,658        7,702
subscribeOn         1  160639,801    16463,799  156911,862     2463,637
subscribeOn        10  148883,172     6885,684  151514,397     9425,348
subscribeOn       100  133756,358     3329,421  133327,933     3479,124
subscribeOn      1000   56411,785    22525,962   52902,999    19948,305
subscribeOn      2000   35471,110    12240,514   34272,374    16515,454
subscribeOn      3000   25868,564     2755,244   26291,293     2435,165
subscribeOn      4000   20453,512     2996,777   19598,400     4643,195
subscribeOn     10000    8817,797      465,195    5389,428      272,784
subscribeOn    100000     958,665       22,157     900,036      320,547
subscribeOn   1000000      91,606        2,462      91,396        3,407

Note that since the tests create a lot of garbage, some perf numbers have quite some error margin: some appear to be faster with this PR while others appear to be slower, even if they are not affected by the changes.

@benjchristensen
Copy link
Member

Am I reading it correctly that this should really only benefit this case? =>

Benchmark      (size)       this   Score error       1.x   Score error
observeOn           1  160377,408     3091,205  140913,081     7097,415

@akarnokd
Copy link
Member Author

Yes, it optimizes for the scalar observing of a value. I assume this is a common enough case to warrant an optimized code path.

@daschl
Copy link
Contributor

daschl commented Feb 23, 2015

This is exactly the case I need :).

@benjchristensen
Copy link
Member

Code looks good. All internal changes. Thanks @akarnokd

benjchristensen added a commit that referenced this pull request Feb 24, 2015
Optimized scalar observeOn/subscribeOn
@benjchristensen benjchristensen merged commit 8614754 into ReactiveX:1.x Feb 24, 2015
@akarnokd akarnokd deleted the ScalarScheduleOn branch February 24, 2015 20:45
@benjchristensen benjchristensen mentioned this pull request Mar 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants