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

[Reactive] Reduce the overhead of flatMapIterable + minor fixes #1563

Merged
merged 1 commit into from
Mar 23, 2020

Conversation

akarnokd
Copy link
Collaborator

The flatMapIterable was underperforming with some short inner collections in benchmarks. The following changes have been applied:

  • Use an inlined SPSC queue instead of the ConcurrentLinkedQueue.
  • Remove the cancel check between the mapping to the iterator and the first hasNext test
  • Disconnect the upstream upon termination so that request on a prefetch boundary becomes no-op (See this discussion.)
  • Add a dedicated cross-mapping benchmark measuring flatMapIterable.

Benchmark

(i7 4770K, Windows 7 x64, JDK 13b29)

image

ShakespearePlaysScrabbleWithHelidonReactiveOpt before  147  34,605 ± 0,210  ms/op
ShakespearePlaysScrabbleWithHelidonReactiveOpt after   153  33,225 ± 0,183  ms/op

@danielkec danielkec added the reactive Reactive streams and related components label Mar 23, 2020
@danielkec danielkec added this to the 2.0.0 milestone Mar 23, 2020
@danielkec danielkec self-assigned this Mar 23, 2020
@danielkec danielkec merged commit 67f299d into helidon-io:master Mar 23, 2020
@akarnokd akarnokd deleted the FlatMapIterablePerf branch March 25, 2020 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reactive Reactive streams and related components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants