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

Investigate optimization of parameter parsing in function constructors #2180

Open
raskad opened this issue Jul 15, 2022 · 0 comments
Open

Investigate optimization of parameter parsing in function constructors #2180

raskad opened this issue Jul 15, 2022 · 0 comments
Labels
enhancement New feature or request parser Issues surrounding the parser

Comments

@raskad
Copy link
Member

raskad commented Jul 15, 2022

For the function constructors we need to parse paramters at runtime e.g.:

const f = Function("a", "b = 1", "console.log(a, b, 'function body')")
f("argA") // argA 1 function body

Currently this is done by concatinating the arguments to a string and parsing that as a paramter list:
https://github.com/boa-dev/boa/blob/main/boa_engine/src/builtins/function/mod.rs#L485-L502

We should investigate if this can be done in a more efficient way without the concatination. The best case would be to reuse as much of the existing parser code as possible. The solution should not introduce loads of new complexity.

Based on discussion here: #2174 (comment)

@raskad raskad added enhancement New feature or request parser Issues surrounding the parser labels Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parser Issues surrounding the parser
Projects
None yet
Development

No branches or pull requests

1 participant