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

asyncio gather vs TaskGroup in async_tree benchmarks #287

Closed
itamaro opened this issue May 7, 2023 · 3 comments · Fixed by #293
Closed

asyncio gather vs TaskGroup in async_tree benchmarks #287

itamaro opened this issue May 7, 2023 · 3 comments · Fixed by #293

Comments

@itamaro
Copy link
Contributor

itamaro commented May 7, 2023

currently, the async_tree set of benchmarks uses asyncio.gather, but asyncio.TaskGroup is the newer cooler thing.

recently I worked on a few asyncio optimizations, and had to patch pyperformance (itamaro@fe365c8) to measure the impact on TaskGroup (in addition to the proposed patch in gh-279 to cover eager task execution).

as an aside, I was also able to compare gather vs TaskGroup (by comparing the results with and without that patch), and found that TaskGroup is faster than gather across the board!

I was wondering what would be the best way to address this in the benchmarks suite.

  1. add yet another set of async_tree flavors that use TaskGroup (in addition to the ones using gather)? (considering the proposed Extend async tree benchmarks to cover eager task execution #279, it's growing the matrix quite a bit)
  2. change the existing set to use TaskGroup instead of gather? (which would make it 3.11+ only, and make it less useful when comparing to older runs that used gather)
  3. keep the existing set as is, but use TaskGroup if it's available, falling back to gather otherwise?
  4. don't bother - leave it with gather
@itamaro
Copy link
Contributor Author

itamaro commented May 7, 2023

@willingc @gvanrossum what do you think?

@gvanrossum
Copy link
Member

I think it's up to @mdboom. In general fixing benchmarks that already exist is painful enough that we don't do it unless there's no other way (e.g. a feature or dependency becomes obsolete). I am fine with adding another benchmark in the asyncio tree family. Maybe @kumaraditya303 has an opinion too?

@kumaraditya303
Copy link
Contributor

I vote for 1, we need benchmarks to cover both gather and taskgroups. Keep me in the loop for any PRs for this.

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 a pull request may close this issue.

3 participants