vercel / vercel/nft

Improve performance of AST parse

Open
#418 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
1.7k
Forks
185
PR merge metrics
No merged PRs in 30d

Description

We currently use acorn for parsing JS into the AST, however there are faster alternatives now.

One of the fastest, @swc/core, is used by Next.js so its perhaps possible to parse once and share the AST so that nft wouldn't need to parse again. However, this could lead to a major rewrite since the AST is not compatible.

Another alternative, hermes-parser, is used by React Native and should have the same AST format (ESTree) which might mean its a drop-in replacement for acorn.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating nft's current acorn-based JavaScript parsing entry point, then compare @swc/core and hermes-parser for AST compatibility and performance. Benchmark the alternatives and determine whether AST sharing is feasible without the major rewrite described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react-native
Domain
performance, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.