Skip to content

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Apr 27, 2022

I think the single(iterable).mapConcat(ConstantFun.scalaIdentityFunction).withAttributes(DefaultAttributes.iterableSource) is too long

The current Source.fromIterable is implemented with a single and StatefulMapConcat, when the upstream's SingleSource is completed, the internal state of StatefulMapConcat is discarded and completed, and the restartingDecider will not make it purpose because isClosed(in) is true.

I think this can enable further optimization in the FlattenMerge, but PR will change the current behavior of Source.fromIterable .

More optimization can be done in FlatMapMerge

@He-Pin He-Pin force-pushed the flattenSource2 branch 5 times, most recently from 939df37 to 387904e Compare April 28, 2022 12:02
@He-Pin He-Pin changed the title =str Add FlattenConcatSource. =str Add IterableSource. Apr 28, 2022
@He-Pin He-Pin force-pushed the flattenSource2 branch 2 times, most recently from 5929665 to 57bb0e7 Compare April 28, 2022 12:09
@He-Pin He-Pin marked this pull request as draft April 28, 2022 13:13
@He-Pin He-Pin marked this pull request as ready for review April 29, 2022 03:15
@johanandren
Copy link
Contributor

Can you explain a bit more what the problem this PR is trying to solve is? Did you observe performance problems with the composed operator?

@He-Pin
Copy link
Contributor Author

He-Pin commented May 11, 2022

@johanandren I was trying to solve refs: #21462

@johanandren
Copy link
Contributor

I see, so it is to be able to determine and optimize iterable sources in for example Akka HTTP. @jrudolph is the new stage here useful for that?

@He-Pin He-Pin marked this pull request as draft September 2, 2022 14:11
@He-Pin He-Pin force-pushed the flattenSource2 branch 5 times, most recently from 063ee82 to 1fb5bcf Compare September 3, 2022 07:07
@He-Pin He-Pin marked this pull request as ready for review September 3, 2022 07:10
@He-Pin He-Pin force-pushed the flattenSource2 branch 2 times, most recently from 86586a6 to 690513f Compare September 3, 2022 08:14
Copy link
Contributor

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good

Copy link
Contributor

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Contributor

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw merged commit 990e646 into akka:main Sep 16, 2022
@patriknw patriknw added this to the 2.7.0-M2 milestone Sep 16, 2022
GreyPlane pushed a commit to GreyPlane/akka that referenced this pull request Sep 17, 2022
@patriknw patriknw modified the milestones: 2.7.0-M2, 2.7.0 Oct 19, 2022
if (isAvailable(out)) {
push(out, currentIterator.next())
}
if (!currentIterator.hasNext) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why call hasNext here,is it ok not to to call here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it just pushed the last element it can immediately complete the stage after that instead of waiting for next pull to make that decision.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants