Skip to content

Automatically defer heavily shared objects in free-threading. #134821

Open
@Fidget-Spinner

Description

@Fidget-Spinner

Feature or enhancement

Proposal:

@corona10 asked if it would be possible to automatically apply deferred refcounting on objects if we notice they're heavily shared in the interpreter through some heuristic. The problem in #134762 (comment) is that we need to defer basically anything shared as it would perform badly in a microbenchmark otherwise.

I think it should be possible. We could rely on biased refcounting to give us a rough estimate on when something is shared, once it's past a certain threshold, we automatically defer the object. Does anyone have a better heuristic to suggest?

Also I'm not going to take this up, as I have too much work on my plate already, so let me know if you'd like to work on it, I can collaborate and provide guidance.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions