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

Improve implementation of merge #340

Open
gjcairo opened this issue Jan 13, 2025 · 1 comment
Open

Improve implementation of merge #340

gjcairo opened this issue Jan 13, 2025 · 1 comment

Comments

@gjcairo
Copy link

gjcairo commented Jan 13, 2025

merge currently allocates more than it should on next calls, by creating new arrays with no pre-reserved capacity. What’s more, in its current form of allowing max 3 streams to be merged, this array could actually just be a tuple and avoid the allocation altogether.

There are comments throughout the implementation that suggest the idea was to eventually use variadic generics to merge N streams. We should decide if this is something we actually want to do, and either reserve enough capacity in the continuations array to avoid the constant resizing, or stick to a tuple if we won’t allow more than 3 (or some other fixed number of) streams.

@bartoszirzyk
Copy link

That would also be a great improvement for combineLatest to be able to accept N sequences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants