Skip to content

Try to shrink stack space#12318

Open
adamchalmers wants to merge 7 commits into
mainfrom
achalmers/smaller-futures
Open

Try to shrink stack space#12318
adamchalmers wants to merge 7 commits into
mainfrom
achalmers/smaller-futures

Conversation

@adamchalmers

@adamchalmers adamchalmers commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Run this:

RUSTFLAGS=-Zprint-type-sizes cargo +nightly build -j1 > type-sizes.txt && top-type-sizes -ws -h33 -p 'run_with_caching\(\)' < type-sizes.txt | head -n 5

and replace run_with_caching with whatever function you want, to see its stack space.

This PR:

  • Boxes some Futures, moving them off the stack into the heap. In theory, worse performance, less stack overflows. I am very confident that the hit from following a pointer to the stack is going to be negligible.
  • Breaks some big functions with lots of awaits into smaller functions, so that the state machine which the async fn creates has fewer and smaller states.

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
modeling-app Ready Ready Preview, Comment Jul 3, 2026 1:02am

Request Review

@adamchalmers adamchalmers marked this pull request as ready for review July 2, 2026 23:15
@adamchalmers adamchalmers requested review from a team as code owners July 2, 2026 23:15
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

Successfully merging this pull request may close these issues.

1 participant