8000 Reuse arrays in visitor keys by fisker · Pull Request #18386 · prettier/prettier · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@fisker
Copy link
Member
@fisker fisker commented Dec 1, 2025

Description

Thanks to @overlookmotel oxc-project/oxc#16294 😄

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

@pkg-pr-new
Copy link
pkg-pr-new bot commented Dec 1, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/prettier/prettier/@prettier/plugin-hermes@18386.tgz
yarn add https://pkg.pr.new/prettier/prettier/@prettier/plugin-oxc@18386.tgz
yarn add https://pkg.pr.new/prettier/prettier@18386.tgz

commit: 1ea2049

@netlify
Copy link
netlify bot commented Dec 1, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit 4d129db
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/692d594ac836c30008fa7bad
😎 Deploy Preview https://deploy-preview-18386--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
netlify bot commented Dec 1, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit 1ea2049
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/692d74fbce047400072e8049
😎 Deploy Preview https://deploy-preview-18386--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fisker fisker force-pushed the shared-visitor-keys branch from 1c6e765 to 9cb9c56 Compare December 1, 2025 09:05
@fisker fisker marked this pull request as ready for review December 1, 2025 10:01
@fisker fisker merged commit d3eb2b2 into prettier:main Dec 1, 2025
34 of 35 checks passed
@fisker fisker deleted the shared-visitor-keys branch December 1, 2025 11:33
@overlookmotel
Copy link
Contributor

Ha! I'm glad I "inspired" you.

I'm actually not sure how much of an optimization it was. Main thing in Oxc is that we wanted to deep freeze visitor keys, so this removed a bunch of freeze calls. Not sure if you're also deep freezing the whole structure or not.

@fisker
Copy link
Member Author
fisker commented Dec 1, 2025

We don't need freeze, since they are not directly accessible. They used under a function call, because we support different languages,

function createGetVisitorKeys(visitorKeys, typeProperty = "type") {

I'm actually not sure how much of an optimization it was.

At least, it reduces the bundle size. 😄

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.

2 participants

0