Sorry, something went wrong.
|
I'm still chasing a refleak, but otherwise this should be ready for review |
Sorry, something went wrong.
|
It looks like @graingert's observation is a serious problem. How can we fix this? |
Sorry, something went wrong.
|
latest version of this PR resolves the issues raised on the issue. tests pass, and rerunning the benchmarks results in pretty much the same results (differences from the original impl within noise margins). benchmarks ran using pyperformance with this patch. |
Sorry, something went wrong.
|
@gvanrossum @carljm Could you please take a quick look at this and make sure it resolved your comments? If so, we can merge. Thanks! |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM (assuming the refcount leak buildbots are happy). Go ahead without waiting for me with further changes!
PS. Next time please resist the urge to rebase -- it's harder to pick up a review after a rebase has happened. We squash commits when we merge them into main anyways.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM barring a couple doc nits and one question.
Sorry, something went wrong.
| } | ||
| } else { | ||
| // This seems to really help performance on pyperformance benchmarks | ||
| Py_CLEAR(task->task_coro); |
There was a problem hiding this comment.
Is this documented anywhere? I can't find it
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
See my comments on #97696.
Sorry, something went wrong.
There was a problem hiding this comment.
Also #104304 as possible documentation.
Sorry, something went wrong.
|
Great to see this land @itamaro. Thanks for being so collaborative on working through the PR. 🎉 |
Sorry, something went wrong.
|
The proposal at the start of this thread suggested a new method or parameter for eager start. Is there a link to any discussion on why this changed? Are there plans to do something like that in future (or just to make it the default, and remove the old behaviour)? I'm thinking about this from a library side. Changing the global task factory is inappropriate for a library to do, but we still have certain tasks that would strongly benefit from eager execution (I also wonder if a user enabling this globally could end up breaking a library that wasn't expecting eager tasks...). So, some way to execute individual tasks eagerly would be useful (unless it simply becomes the default behaviour). We currently instantiate Task(eager_start=True) directly, though the docs seem to strongly discourage this. Adding an eager_start to asyncio.create_task(), or maybe some way to temporarily change task factories (with eager_task_factory:) would be ideal. |
Sorry, something went wrong.
fixes gh-97696
pyperformance results:
pyperformance run performed with local patch that installs the eager tasks factory by default (modifying the benchmark itself to use it requires psf/pyperf#157)
full comparison in this gist