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

populate defaultValues in webidl dict. converter when passing null or undefined #3518

Merged

Conversation

KhafraDev
Copy link
Member

… undefined

The test explains the commit purpose better.

benchmarks/fetch/request-creation.mjs was consistently 10-15% faster. Not sure how @Uzlopak @tsctx, was this a fluke?

lib/web/fetch/webidl.js Outdated Show resolved Hide resolved
@Uzlopak Uzlopak changed the title populate defaultValues in webidl dict. converter when passing null or… populate defaultValues in webidl dict. converter when passing null or undefined Aug 27, 2024
@KhafraDev
Copy link
Member Author

I'm still confused how Request creation (with no RequestInit) is 10-15% faster.

Copy link
Member

@tsctx tsctx left a comment

Choose a reason for hiding this comment

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

The constructor of Request has an empty object by default, so passing undefined to RequestInit will result in default value.
The performance increase is probably due to the removal of Object.hasOwn.

@KhafraDev
Copy link
Member Author

I thought it could be Object.hasOwn, but the extra "overhead" from now having to loop over all of the converters made me think it would be slower. That's why I bothered benchmarking it in the first place.

@KhafraDev KhafraDev merged commit c108287 into nodejs:main Aug 28, 2024
32 checks passed
@KhafraDev KhafraDev deleted the webidl-null-undefined-populate-defaultvalue branch August 28, 2024 04:05
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