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

Skip printing createAstro code if unused #1002

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Skip printing createAstro code if unused #1002

merged 1 commit into from
Apr 19, 2024

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 18, 2024

Changes

Idea from withastro/astro#10773 (review)

If the Astro global is not used, we don't need to print code that calls createAstro. This saves on runtime execution as it's created but not used.


Perf:

  • createAstro() calls dropped from 571ms o 551ms. -0.02s (not a lot, but it helps other cases instead like garbage collection and AST parsing)
  • garbage collection dropped from 59.52s to 40.88s. -18.7s

Testing

Updated tests to handle cases where the createAstro code is no longer present.

Docs

n/a. internal improvement.

Copy link

changeset-bot bot commented Apr 18, 2024

🦋 Changeset detected

Latest commit: f02b6de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

great idea!

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Very awesome idea, nice work!

@bluwy bluwy merged commit e8b6cdf into main Apr 19, 2024
5 checks passed
@bluwy bluwy deleted the skip-astro-global branch April 19, 2024 15:41
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

4 participants