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

Synthetic benchmark on a few pending PRs combined. #122

Closed
andersio opened this issue Nov 25, 2016 · 0 comments
Closed

Synthetic benchmark on a few pending PRs combined. #122

andersio opened this issue Nov 25, 2016 · 0 comments
Labels

Comments

@andersio
Copy link
Member

andersio commented Nov 25, 2016

Benchmark Source
#106 + #112 + #107 + #113

Seven scenarios

  1. Send 10000 events to 1 observer of a plain signal.
  2. Send 10000 events to 8 observers of a plain signal.
  3. Send 10000 events to 1 observer of a produced signal from a 5-times-transformed producer.
  4. Send 10000 events to 2 observer of a produced signal from a 5-times-transformed producer.
  5. Start, send one event to and dispose a 5-times-transformed producer for 10000 times.
  6. Start a 5-times-transformed producer for 10000 times.
  7. Start and dispose a 5-times-transformed producer for 10000 times.

TL;DR

  1. A non-trivial regression in sending events. (as a result of the interruption handling fix in Mitigate race conditions in the interruption handling. #112). Transformed producer would amplify the effect.
  2. But if there is enough work done for each event (e.g. invoking eight empty observers), the regression would be outweighed.
  3. Single-digit-percentage improvements in the SignalProducer starting & disposing performance.
  4. When it comes to a common pattern for a scrolling collection views (rebinding reusable cells to different producers, represented by scenario 5), there is a minor net improvement.

Further optimization

  1. Synchronise Signal.observers using read-copy-update. This removes a lock from the critical path of a Signal, at a cost of more expensive observer insertion.
// -Owholemodule
// `signal-state-patch` + `disposable-lockfree` + `lift-fix` + `minor-signal-refactor`
One Observer:    0.026 12%
Eight Observers: 0.042 8%
Producer:        0.326 3%
Producer 2 obv:  0.632 2%
Producer Mixed:  2.038 2%
Start Producer:  1.582 2%
Start & Dispose: 1.581 2%

// `master`
One Observer:    0.018 10%
Eight Observers: 0.053 5%
Producer:        0.223 3%
Producer 2 obv:  0.422 2%
Producer Mixed:  2.090 2%
Start Producer:  1.663 2%
Start & Dispose: 1.683 2%

// Speedup
One Observer:    0.692x ***
Eight Observers: 1.262x
Producer:        0.684x ***
Producer 2 obv:  0.668x ***
Producer Mixed:  1.025x
Start Producer:  1.051x
Start & Dispose: 1.065x
@andersio andersio changed the title Synthetic benchmark of a few pending PRs combined. Synthetic benchmark on a few pending PRs combined. Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant