-
Notifications
You must be signed in to change notification settings - Fork 608
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
Stream.fromIterator doesn't create proper chunks #2010
Comments
Any thoughts on |
It's more general, but it would incur the chunk management overhead. It's going to be significantly slower than batching |
I haven't done proper performance testing, only a few tests within a CSV parsing library, so my claims below my not be fully correct. However, the processing time I've measured for You're probably right that we should avoid using iterator for performance-sensitive operations. But sometimes, in existing projects, the iterator may be the only interface you have available and even if the code isn't really performance-sensitive, making it more efficient can still be valuable. |
OK, let's move on to a PR then. Thanks for testing. |
Create chunks in Stream.fromIterator (#2010)
Solved wit PR #2013. |
Stream.fromIterator
fetches values one by one, effectively creating single-value chunks. This has negative impact on performance, especially when working with primitive values.The situation is even worse for
Stream.fromBlockingIterator
, because context switch for each fetched value increases the performance penalty.I think this could be improved with following implementation of
PartiallyAppliedFromIterator
:Similarly with
PartiallyAppliedFromBlockingIterator
.If you find this solution OK I would be happy to prepare and submit a PR.
The text was updated successfully, but these errors were encountered: