Skip to content

Do more aggressive lambda lifting #1886

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OlivierNicole
Copy link
Contributor

With @vouillon we realized that the Lambda_lifting_simple pass that is performed by double translation makes some programs significantly faster. We measured roughly a 1.45 speedup on a large (proprietary) Bonsai benchmark. Presumably V8 is much faster with more toplevel functions and less nested closures.

Making this a draft PR for now because:

  • It should probably be behind a flag: it makes the generated Javascript further from the source code structure;
  • It theoretically results in a quadratic code size.

We probably need to do some measurements before merging. (And maybe with other engines.)

@vouillon vouillon force-pushed the more-lambda-lifting branch 2 times, most recently from 83fff63 to 418e0ed Compare March 21, 2025 14:20
@vouillon vouillon force-pushed the more-lambda-lifting branch from 580b603 to e76cef3 Compare April 7, 2025 13:28
@vouillon vouillon force-pushed the more-lambda-lifting branch from b59bd3e to 25929ef Compare April 7, 2025 22:10
@OlivierNicole
Copy link
Contributor Author

This seems to result in a modest speedup on average, including on partial_render_table. Is this the version of the benchmark that has a memory leak?

@vouillon
Copy link
Member

vouillon commented Apr 8, 2025

This seems to result in a modest speedup on average, including on partial_render_table. Is this the version of the benchmark that has a memory leak?

No, I'm using a workaround.

@vouillon vouillon force-pushed the more-lambda-lifting branch from 25929ef to 9e363d1 Compare April 18, 2025 08:57
@OlivierNicole
Copy link
Contributor Author

Should I guard this by an --enable lambda-lift-all option?

@vouillon
Copy link
Member

Yes, you should add a flag.

@OlivierNicole OlivierNicole force-pushed the more-lambda-lifting branch 2 times, most recently from 025b1bd to 3f94285 Compare April 30, 2025 09:45
With @vouillon we realized that the `Lambda_lifting_simple` pass that is
performed by double translation makes some programs significantly
faster. We measured roughly a 1.45 speedup on a large (proprietary)
Bonsai benchmark. Presumably V8 is much faster with more toplevel
functions and less nested closures.
@OlivierNicole
Copy link
Contributor Author

I re-ran the CI a few times to double-check whether this new pass increases the compilation time. The compilation time seems to oscillate around ±2 %, so I would say it’s in the noise.

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

Successfully merging this pull request may close these issues.

2 participants