Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Avoid revalidating the entire remaining UTF-8 source for every lexer character

オープン 初心者向け
#935 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
compilers

調査の方向性

まず front/lexer/src/cursor.rs の advance メソッドと peek メソッドを確認し、次に #392 で追加された既存の UTF-8 カーソルテストを読みます。カーソルのオフセットと診断列がどのように記録されるかを確認し、長い入力を対象とするテストを追加する前後に lexer のテストを実行します。完了条件は、UTF-8 の処理とスパンを正しく保ちながら、文字ごとの操作で残りのサフィックス全体を検証しなくなることです。時間のアサーションは設けずに、スケーリングの測定結果を記録してください。

索引モデルが issue の本文から書いたものです。

説明

good first issue performance

Problem

Lexer already stores its input as &str, but advance and peek repeatedly call std::str::from_utf8 on the entire remaining suffix. A long comment performs this linear suffix validation for each character, giving quadratic scanning work even though only the next character is needed.

Starting points: front/lexer/src/cursor.rs:25 and front/lexer/src/cursor.rs:47. Preserve the UTF-8 byte-offset and diagnostic-column contract; this is a cursor hot-path fix, not a lexer redesign. #392 added UTF-8 correctness tests but does not cover repeated suffix validation.

Reproduction

Audited canonical master d59bdab376bdc04edacdc8029b256cb8d55b5adf on Linux amd64 with a checkout-built Wave 0.0.1-alpha-dev, Rust 1.89.0 and LLVM 21.1.8.

With the debug compiler, checked files containing /* + N ASCII a characters + */\nfun main() {}\n, three executions per size:

Comment bytes Elapsed seconds
30,000 0.0707, 0.0633, 0.0665
60,000 0.2024, 0.2087, 0.1956
120,000 0.7333, 0.7140, 0.7221

All checks succeed. Doubling the long comment approaches four times the scanning cost. These are debug-build observations, not release benchmark claims. The repeated full-suffix validation is also directly visible in the source.

Reproduce with target/debug/wavec check long-comment.wave; use time.perf_counter() around repeated subprocess invocations and keep the number of tokens constant.

Scope

Decode/look ahead within the already-valid string without scanning its full suffix again. Difficulty: easy; the existing UTF-8 cursor tests provide a starting point.

Completion criteria

  • Preserve multibyte identifiers, comments, strings, CR/LF tracking and diagnostic spans.
  • Remove full-suffix UTF-8 validation from per-character cursor operations.
  • Add focused long-input correctness coverage and record scaling measurements; avoid a flaky wall-clock assertion in unit tests.
主要言語
Rust
スター
56
フォーク
21
平均マージ
4時間 58分
マージ済み PR(30日)
54

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wavefnd/Wave のほかの issue

wavefnd/Wave の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。