Skip to content

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?

@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
@KhafraDev KhafraDev deleted the webidl-null-undefined-populate-defaultvalue branch August 28, 2024 04:05
@github-actions github-actions bot mentioned this pull request Dec 3, 2024
This was referenced Dec 16, 2024
@github-actions github-actions bot mentioned this pull request Mar 12, 2025
@github-actions github-actions bot mentioned this pull request May 12, 2025
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