oxc-project / oxc-project/backlog

Optimized string search / trim / slice methods

Open
#117 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

https://github.com/oxc-project/oxc/pull/6151 introduced string search routines optimized for ASCII strings for parsing JSX pragmas.

These routines could be generalized and put in their own crate.

We use functions like str::trim all over the codebase, but it's quite slow as it handles non-ASCII characters in its hot path. But typical JS code which Oxc processes is almost entirely ASCII, so we can benefit from routines optimized for ASCII, which handle non-ASCII characters in a cold path.

trim_end introduced in https://github.com/oxc-project/oxc/pull/6151 is a great deal smaller and faster on its hot ASCII path than std::str::trim_end: https://godbolt.org/z/4nfW6183z

We can also provide optimized string search routines where the character being searched for is ASCII (typical usage).

We may want to replicate Rust's nightly std::ascii::Char or reuse parts of the ascii crate.

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

Review PR #6151 and the string search routines it introduced first. Determine the crate and API scope for ASCII-optimized trim, search, and slice methods, including non-ASCII handling, then compare the routines with the standard library using the linked Godbolt example or equivalent benchmarks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.