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.
Found while stress-testing write barriers (main @ 09760e6, macOS arm64, release build of perry).
A single object literal with thousands of keys makes
perry compilesuperlinearly slow:Generator for a repro file:
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.