Skip to content

feat(shiki): use wasm engine #320

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

Merged
merged 1 commit into from
Jun 26, 2025
Merged

feat(shiki): use wasm engine #320

merged 1 commit into from
Jun 26, 2025

Conversation

avivkeller
Copy link
Member

Using the WASM generator rather than the JS one results in ~50% cheaper runs.

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 15:14
@avivkeller avivkeller requested a review from a team as a code owner June 25, 2025 15:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR switches Shiki’s syntax highlighter from the JavaScript regex engine to the faster Oniguruma WASM engine, reducing execution cost by ~50%.

  • Replaced createJavaScriptRegexEngine import and usage with createOnigurumaEngine
  • Updated highlighter initialization to use dynamic WASM import

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.57%. Comparing base (b3e2fbd) to head (3f70af7).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #320       +/-   ##
===========================================
+ Coverage   51.15%   66.57%   +15.42%     
===========================================
  Files          81       81               
  Lines        6956     6956               
  Branches      306      339       +33     
===========================================
+ Hits         3558     4631     +1073     
+ Misses       3395     2322     -1073     
  Partials        3        3               

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller added the fast track This PR can land before the typical review time, with a :+1: from collaborators label Jun 26, 2025
@avivkeller
Copy link
Member Author

avivkeller commented Jun 26, 2025

Requesting fast-track so I can improve other aspects of Shiki's speed without conflicts.

Edit: Nevermind, the improvement I had in mind did not improve speeds.

@avivkeller avivkeller removed the fast track This PR can land before the typical review time, with a :+1: from collaborators label Jun 26, 2025
@AugustinMauroy AugustinMauroy merged commit 2faca0b into main Jun 26, 2025
10 checks passed
@AugustinMauroy AugustinMauroy deleted the shiki-wasm branch June 26, 2025 19:50
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.

3 participants