Skip to content

feat: add opt-in twoslash build cache#118

Open
IMax153 wants to merge 1 commit into
withstudiocms:mainfrom
IMax153:feat/twoslash-disk-cache
Open

feat: add opt-in twoslash build cache#118
IMax153 wants to merge 1 commit into
withstudiocms:mainfrom
IMax153:feat/twoslash-disk-cache

Conversation

@IMax153
Copy link
Copy Markdown
Contributor

@IMax153 IMax153 commented Mar 30, 2026

Description

  • Closes #
  • What does this PR change?
  • Be short and concise. Bullet points can help!
  • Before/after screenshots can help as well.
  • Don't forget a changeset! Run pnpm changeset.

Docs

@IMax153 IMax153 requested review from a team and Adammatthiesen as code owners March 30, 2026 18:26
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 30, 2026

🦋 Changeset detected

Latest commit: 67ca552

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

This PR includes changesets to release 1 package
Name Type
expressive-code-twoslash 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

@IMax153 IMax153 changed the title feat: add opt-in twoslash cache feat: add opt-in twoslash build cache Mar 30, 2026
@IMax153
Copy link
Copy Markdown
Contributor Author

IMax153 commented Mar 30, 2026

👋 Hey @Adammatthiesen! We're currently working on the next iteration of the Effect Website, and I'm trying to optimize build times as much as possible.

As you know, we make heavy use of your expressive-code-twoslash plugin for rendering our code snippets, and I'm sure you know that the more Twoslash snippets you have, the slower the build times.

I've been experimenting on our new site with a build-time cache for Twoslash snippets. I locally patched the expressive-code-twoslash plugin to include support for caching Twoslash snippets based on deterministic keys.

For an Astro build with my cache PoC including ~40 Twoslash snippets, the cold build time was ~25s and warm build time was ~15s. Obviously this scales with more and more snippets that are cached vs. uncached, and the actual Effect website has many more snippets than this.

Given the positive results, I figured I'd make a PR to expressive-code-twoslash to see if you're interested in upstreaming this functionality.

Please note that the PR is fully AI generated - I'm happy to clean it up if you're interested in upstreaming it, and also happy to make whatever changes to the public API you want too!

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.

1 participant