Skip to content

polish: remove check for collecting forbidden directives from execution #4360

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

Closed
wants to merge 2 commits into from

Conversation

yaacovCR
Copy link
Contributor

follow on from #3974

@yaacovCR yaacovCR requested a review from a team as a code owner March 23, 2025 08:33
@yaacovCR yaacovCR requested review from benjie and removed request for a team March 23, 2025 08:33
@yaacovCR yaacovCR added the PR: polish 💅 PR doesn't change public API or any observed behaviour label Mar 23, 2025
Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

I personally find the boolean approach a lot cleaner, js engines will also have an easier time optimising the top level function with a flag compared to the adhoc created func.

It's also a lot harder to reason about as we add a layer of indirection and the forbidden directives become a hook. I.e. we create an exact replica of shouldIncludeNode that just has an extra step to push to an outer scope array.

@yaacovCR yaacovCR changed the title do not check for collecting forbidden directives during execution polish: remove check for collecting forbidden directives from execution Mar 23, 2025
@yaacovCR
Copy link
Contributor Author

@JoviDeCroock

I suppose this is a style issue, I prefer the changes in this PR as I find it simpler to reason about, but not strongly enough that I would push this.

In terms of performance, I added a benchmark to demonstrate that there is no significant/reproducible performance penalty for the dynamic function, which also confirms my suspicion that there is no significant/reproducible performance hit for the current approach, so it's all in terms of readability, and I am fine to stick with the status quo, although see #4361.

@yaacovCR yaacovCR closed this Mar 23, 2025
@yaacovCR yaacovCR deleted the do-not branch March 23, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: polish 💅 PR doesn't change public API or any observed behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants