Skip to content

Skip printing createAstro code if unused#1002

Merged
bluwy merged 1 commit into
mainfrom
skip-astro-global
Apr 19, 2024
Merged

Skip printing createAstro code if unused#1002
bluwy merged 1 commit into
mainfrom
skip-astro-global

Conversation

@bluwy
Copy link
Copy Markdown
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.

@changeset-bot
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
@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.

4 participants