Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tscircuit autorouter running in porffor #206

Open
seveibar opened this issue Oct 23, 2024 · 1 comment
Open

tscircuit autorouter running in porffor #206

seveibar opened this issue Oct 23, 2024 · 1 comment

Comments

@seveibar
Copy link

File: https://github.com/tscircuit/autorouting/blob/main/algos/algorithm-template-ts/benchmark.ts

Compiled with bun build ./benchmark.ts

Run with porf --module ./benchmark.js

➜  algorithm-template-ts git:(0fc33cb) ✗ porf -d --module ./benchmark.js
RangeError: Maximum call stack size exceeded
    at generateForOf (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:4200:7)
    at generate (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:265:29)
    at generateCode (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:6380:22)
    at generate (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:213:29)
    at Object.generate (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:6206:14)
    at funcRef (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:52:18)
    at generateFunc (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:6371:66)
    at generate (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:210:29)
    at generateClass (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:5848:10)
    at generateFunc (file:///Users/seve/.nvm/versions/node/v22.3.0/lib/node_modules/porffor/compiler/codegen.js:6058:17)
@Rob23oba
Copy link
Contributor

The current implementation of for-of in porffor duplicates code. Nested for-of loops (which appear in the benchmark) make this much worse and causes more instructions to generate than it can handle. The crash here in particular is because porffor uses array.push(...values); to push values into an array, which breaks with too many parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants