oxc-project / oxc-project/backlog

Provide API for reading source text from disk into a buffer

Open
#94 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

The most common use case for Oxc is reading a file from disk and parsing it.

Currently the parser takes a &str. We could add an API to read a file from disk into a SourceText buffer which is then passed to parser. Possibly SourceText would store the data in the arena.

There's a few advantages to this:

  1. If you reuse the same SourceText buffer over and over when parsing many files, that'd likely be a perf gain, as source text would always be in a block of memory which is warm in the cache.
  2. It'd remove the cost of string copying for #20.
  3. It'd be useful for AST transfer for the source text to be in the arena - could make for more efficient code for extracting strings from the serialized buffer.

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 reviewing the parser API that currently accepts a &str and the proposed SourceText buffer described in the issue. Determine how disk input, buffer reuse, arena storage, and AST transfer should fit together; done requires an agreed API and implementation plan that addresses these goals.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
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.