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

perf(webidl): optimize dictionary converters #16594

Closed
wants to merge 3 commits into from

Conversation

littledivy
Copy link
Member

5x-11x improvement across inputs.

Before:

test converter_object               ... bench:      40,076 ns/iter (+/- 2,482)
test converter_undefined            ... bench:      25,025 ns/iter (+/- 2,521)
test handwritten_baseline_object    ... bench:       3,444 ns/iter (+/- 164)
test handwritten_baseline_undefined ... bench:       3,375 ns/iter (+/- 76)

After:

test converter_object               ... bench:       3,800 ns/iter (+/- 371)
test converter_undefined            ... bench:       3,769 ns/iter (+/- 561)
test handwritten_baseline_object    ... bench:       3,503 ns/iter (+/- 1,010)
test handwritten_baseline_undefined ... bench:       3,343 ns/iter (+/- 124)

littledivy added a commit that referenced this pull request Jan 15, 2023
This commits add a `webidl.createDictionaryConverter` converter
microbenchmark.

There are 2 PRs currently open that need a microbenchmark for webidl
dictionary converter. See #16594
and #16407

Closes #17436
@littledivy littledivy marked this pull request as ready for review January 15, 2023 14:13
Comment on lines +685 to +690
return new Function(
"makeException",
"type",
"defaultValues",
"allMembers",
`return function (V, opts = {}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause the process to fail if --disallow-code-generation-from-strings flag is used (#16535)

bartlomieju pushed a commit that referenced this pull request Jan 16, 2023
This commits add a `webidl.createDictionaryConverter` converter
microbenchmark.

There are 2 PRs currently open that need a microbenchmark for webidl
dictionary converter. See #16594
and #16407

Closes #17436
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there isn't anything that could be done to optimize these without running afoul of the eval issue.

If not, should this be closed?

@littledivy
Copy link
Member Author

Uhh this is a nice optimization. we need to somehow do this without JS eval :(

Opened #18431

@littledivy littledivy closed this Mar 25, 2023
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.

None yet

3 participants