-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
JqwikStreamSupport#concat(List<Stream<T>>) seem to be O(N^2) #305
Comments
At first glance
should work. However, it breaks in recursive scenarios, probably due to the laziness of Java streams. I added a clarifying comment to the code. Have you noticed any detrimental effects of the current solution? BTW, the flat-map version will also be O(n^2) (I think), it's just that you don't see it at once from the code. |
At the time I had read https://www.techempower.com/blog/2016/10/19/efficient-multiple-stream-concatenation-in-java/ and decided on the current implementation anyway. Probably for the reason mentioned above. |
The most significant effect was I spent noticeable time trying to understand the logic behind It used |
Why? As per the article, |
I don't think it does. |
Testing Problem
See https://github.com/jlink/jqwik/blob/00185e2d52137ab12bff0b7dee180f96542fded4/engine/src/main/java/net/jqwik/engine/support/JqwikStreamSupport.java#L58-L68
The code is hard to follow, and it creates multiple temporary
ArrayList
objects (one per element).Suggested Solution
Would
.flatMap
work?For example:
The text was updated successfully, but these errors were encountered: