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

Task / Coeval Run-loop Optimizations, First Batch #474

Merged
merged 18 commits into from Dec 26, 2017

Conversation

Projects
None yet
1 participant
@alexandru
Member

alexandru commented Dec 9, 2017

Addresses #452.

Porting my optimizations for cats-effect that I did in these PRs:

  1. cats-effect/90
  2. cats-effect/91
  3. cats-effect/95

In particular the optimizations applied by this PR are:

  1. transformed the run-loops into plain while loops operating on var values
  2. introduced .map fusion, using a special Map internal state that keeps count of the "fused" map functions, to then trigger a flatMap boundary once the maximum count is reached, in order to avoid StackOverflow errors

Results are good. Even though we seemingly suffer from a performance regression in error handling, there's a clear improvement in all other benchmarks.


For Coeval:

Benchmark 3.0.0-M2 This PR
CoevalAttemptBenchmark.errorRaised 2558.607 2151.632
CoevalAttemptBenchmark.happyPath 2229.695 2215.226
CoevalDeepBindBenchmark.delay 5032.942 7339.973
CoevalDeepBindBenchmark.pure 7722.522 7459.140
CoevalHandleErrorBenchmark.errorRaised 4977.696 2104.993
CoevalHandleErrorBenchmark.happyPath 6655.720 3461.125
CoevalMapCallsBenchmark.batch120 5737.880 13733.352
CoevalMapCallsBenchmark.batch30 4802.375 15693.191
CoevalMapCallsBenchmark.one 4839.963 6227.005
CoevalMapStreamBenchmark.batch120 2330.758 3370.183
CoevalMapStreamBenchmark.batch30 845.800 1458.293
CoevalMapStreamBenchmark.one 1363.485 1546.842
CoevalShallowBindBenchmark.eval 4360.160 5499.956
CoevalShallowBindBenchmark.now 6127.387 6475.038

For Task:

Benchmark 3.0.0-M2 This PR
TaskAttemptBenchmark.errorRaised 1976.251 2289.696
TaskAttemptBenchmark.happyPath 2358.121 2424.123
TaskDeepBindBenchmark.async 357.975 375.224
TaskDeepBindBenchmark.delay 6121.142 6531.292
TaskDeepBindBenchmark.pure 6112.579 6888.964
TaskHandleErrorBenchmark.errorRaised 2296.135 2143.582
TaskHandleErrorBenchmark.happyPath 3662.866 3213.625
TaskMapCallsBenchmark.batch120 3850.962 13642.335
TaskMapCallsBenchmark.batch30 3305.231 12277.324
TaskMapCallsBenchmark.one 1558.690 1624.390
TaskMapStreamBenchmark.batch120 2177.100 3333.050
TaskMapStreamBenchmark.batch30 885.076 1448.015
TaskMapStreamBenchmark.one 1520.548 1423.785
TaskShallowBindBenchmark.async 166.524 150.859
TaskShallowBindBenchmark.delay 5237.632 5413.998
TaskShallowBindBenchmark.pure 6328.294 6178.424

alexandru added some commits Dec 9, 2017

@codecov

This comment has been minimized.

codecov bot commented Dec 9, 2017

Codecov Report

Merging #474 into master will decrease coverage by 6.51%.
The diff coverage is 96.91%.

@@            Coverage Diff             @@
##           master     #474      +/-   ##
==========================================
- Coverage   90.09%   83.57%   -6.52%     
==========================================
  Files         353      353              
  Lines        8883     9669     +786     
  Branches     1738     1815      +77     
==========================================
+ Hits         8003     8081      +78     
- Misses        880     1588     +708

@alexandru alexandru changed the title from WIP: Run-loop Optimizations, First Batch to Task / Coeval Run-loop Optimizations, First Batch Dec 25, 2017

@alexandru alexandru merged commit 668a8b9 into monix:master Dec 26, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@alexandru alexandru added this to the 3.0.0 milestone Jan 21, 2018

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