Skip to content

Compile-time blowup on wide object literals (2100 keys ≈ 2 min, 3000 keys > 7 min) #4880

Description

@proggeramlug

Found while stress-testing write barriers (main @ 09760e6, macOS arm64, release build of perry).

A single object literal with thousands of keys makes perry compile superlinearly slow:

keys in one literal compile wall time
300 seconds
2100 ~114 s
3000 killed after ~7 min

Generator for a repro file:

python3 -c "
fields = ',\n'.join(f'    f{i}: {{ v: {i} }}' for i in range(2100))
open('wide.ts','w').write('const src: any = {\n' + fields + '\n};\nconsole.log(\"ok\");\n')
"
perry compile wide.ts -o wide_bin   # ~2 minutes

The scaling looks roughly quadratic in the number of literal fields, so it's probably an O(n²) walk in object-literal lowering/codegen (shape registration or per-field key scanning). Real-world impact: large generated config/lookup-table modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions