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

Async optimizations #45

Open
insanitybit opened this issue Jul 20, 2022 · 1 comment
Open

Async optimizations #45

insanitybit opened this issue Jul 20, 2022 · 1 comment

Comments

@insanitybit
Copy link

Some async performance stuff:

  1. Concurrency where possible ie:

don't do:

let a = foo().await;
let b = bar().await;

do:

let (a, b) = join!(foo, bar).await;
  1. Also, spawn may not be ideal for performance. It can be better to refactor to avoid that.

  2. Recursive futures imply a heap allocation for every frame. If you can refactor the code to be imperative you may be able to avoid that.

Just some thoughts!

@frederikhors
Copy link

Wow, can you create a PR with examples @insanitybit? Amazing suggestions!

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