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

Use the new compiler in Vite plugin #1264

Merged
merged 63 commits into from Jan 28, 2024
Merged

Use the new compiler in Vite plugin #1264

merged 63 commits into from Jan 28, 2024

Conversation

mrm007
Copy link
Contributor

@mrm007 mrm007 commented Dec 28, 2023

Fixes #1211.

This PR rewrites the Vite plugin to use a new compiler powered by vite-node, introduced by @markdalgleish in #1030.

TL;DR: the new plugin is ~5x faster (on average) than the current plugin. More details can be found in each changeset.

Pre-release versions (snapshots) of this plugin can be found here: Github Actions (install them with pnpm add @vanilla-extract/vite-plugin@vite-plugin-new).

I've tested various snapshots in Remix using the unstable Vite plugin.

Using a fresh app created with sku init, with Braid and Remix, the results are below:

{
  "minimum compilation time (in ms)": {
    "current": 59,
    "new": 386
    // for small files with no dependencies, the new compiler adds some overhead
  },
  "maximum compilation time (in ms)": {
    "current": 6794,
    "new": 1422,
    "comparison": "20.93% of current"
  },
  "median": {
    "current": 2071,
    "new": 1160,
    "comparison": "55.96% of current"
  },
  "average": {
    "current": 2333,
    "new": 548,
    "comparison": "23.48% of current"
  }
}

I also tested in a repo that had performance issues with Mantine:

{
  "minimum compilation time (in ms)": {
    "current": 6692,
    "new": 1395,
    "comparison": "20.84% of current"
  },
  "maximum compilation time (in ms)": {
    "current": 9478,
    "new": 1726,
    "comparison": "18.21% of current"
  },
  "median": {
    "current": 9117.5,
    "new": 1586,
    "comparison": "17.39% of current"
  },
  "average": {
    "current": 8731,
    "new": 1581,
    "comparison": "18.1% of current"
  }
}

Copy link

changeset-bot bot commented Dec 28, 2023

🦋 Changeset detected

Latest commit: 030d8df

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

This PR includes changesets to release 2 packages
Name Type
@vanilla-extract/integration Minor
@vanilla-extract/vite-plugin Major

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

Base automatically changed from thirdparty-fixture to master January 16, 2024 06:42
packages/integration/src/compiler.ts Show resolved Hide resolved
packages/integration/src/compiler.ts Show resolved Hide resolved
packages/vite-plugin/src/index.ts Outdated Show resolved Hide resolved
packages/vite-plugin/src/index.ts Outdated Show resolved Hide resolved
@mrm007 mrm007 merged commit e531c41 into master Jan 28, 2024
11 checks passed
@mrm007 mrm007 deleted the vite-plugin-new branch January 28, 2024 23:22
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.

Performance issues with Vite plugin
3 participants