Skip to content

Use interned versions of string constants if they're already presentย #140328

@efimov-mikhail

Description

@efimov-mikhail

Feature or enhancement

Proposal:

For now intern_constants function in Objects/codeobject.c uses should_intern_string to check if that string should be interned. And do nothing if should_intern_string returned 0. Maybe it'll be better to check if this string already have interned variant and use it if present? Because there's no need to keep equal strings in memory. The small downside is some time needed for this checking.

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

    Labels

    easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions