Skip to content

Excessive runtime for nested OrderedDict instances #3123

@Glyphack

Description

@Glyphack

Summary

I found this to be slow when type checking:

from collections import OrderedDict

OrderedDict(OrderedDict(OrderedDict(OrderedDict(OrderedDict(OrderedDict(("one", 1)))))))

Playground

This takes about 11 seconds on my machine.

The example was found using a fuzzer.
While this example is not a real program someone would write, I'm submitting it in case the root cause can slow down ty in other situations that are useful. Feel free to close if it's unrelated.

Version

0.15.7+22 (dd6d84305 2026-03-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fuzzerIssues surfaced by fuzzing typerformancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions