Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Coroutines Conversion: Migrate streams compression to coroutines #866

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

kflansburg
Copy link
Contributor

No description provided.

@kflansburg kflansburg requested a review from jasnell July 14, 2023 16:51
@kflansburg kflansburg force-pushed the kflansburg/coroutines-compression branch from 4ec20c1 to e55be85 Compare July 14, 2023 16:52
Co-authored-by: Kenton Varda <kenton@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
@jasnell jasnell changed the title Migrate streams compression to coroutines Coroutines Conversion: Migrate streams compression to coroutines Jul 17, 2023
@kflansburg kflansburg merged commit 66e857b into main Jul 17, 2023
@kflansburg kflansburg deleted the kflansburg/coroutines-compression branch July 17, 2023 19:17
});
if (pieces.size() != 0) {
co_await write(pieces[0].begin(), pieces[0].size());
co_await write(pieces.slice(1, pieces.size()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm late to the review, but want to point out that this conversion inhibits tail-call optimization. If pieces is sufficiently large, this could theoretically cause a stack overflow.

To avoid this problem, this recursive write() function would need to be refactored into a for loop.

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

Successfully merging this pull request may close these issues.

5 participants