Skip to content

英語の初回候補を高速化 / Reduce cold English candidate latency - #1279

Closed
KazumaProject wants to merge 1 commit into
devfrom
codex/english-cold-candidates
Closed

KazumaProject wants to merge 1 commit into
devfrom
codex/english-cold-candidates

Conversation

@KazumaProject

@KazumaProject KazumaProject commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

日本語

Pixel 6 でプロセス起動後の最初の入力に and を使うと、英語辞書の準備完了後も、単語補完が1,809件の読みを走査していました。計測した回では補完に146 msかかり、辞書の木の走査が約86 msを占めました。速く打つと、直前の an の補完処理も次の入力まで残りました。

  • 辞書の木をたどる際、連続するノードのラベルと区切り位置を再利用します。補完対象外の枝は早い段階で除外し、ビット位置の探索には二分探索を使います。
  • 新しい入力が前の要求をキャンセルしたとき、実行中の英語補完も打ち切ります。
  • 実機ハーネスで候補の入力長を照合します。たとえば、an の候補に現れた and を and の表示時刻に数える誤判定を防ぎます。

Pixel 6、Android 17、Full Standard Debug。プロセス停止後の最初の単語を画面上の QWERTY で85 ms間隔で打ち、最後のキーから候補欄の描画直前までを各条件3回測りました。

最初の入力 ライブ変換 dev の中央値 修正後の中央値
and オフ 226 ms 202 ms
and オン 246 ms 203 ms
and(40 ms間隔) オフ 290 ms 257 ms
  • 10語のタイピングで、取得した候補の内容と表示順が一致しました。別の6語をそれぞれ最初に打った単回計測でも、候補の内容と順序が一致しました。たとえば the は167 msから124 ms、open は125 msから101 ms、can は134 msから156 msでした。
  • 実機の英語辞書テスト20件が成功しました。監査では通常の変換経路と従来経路のそれぞれで16,343入力を確認しました。関連ユニットテスト13件と Lite Standard Debug のビルドも成功しました。Lite は同じ Pixel 6 で and、can、hello、testing の入力と候補表示を確認しました。
  • 辞書ブラウザーの辞書数テストは dev と修正後で同じ失敗を再現しました。期待値39件に対して150件です。
  • 主要な英語辞書・索引・文法データ5点は Full 840 の配布用 AAB と SHA-256 が一致しました。計測は隔離した Debug ビルドで行い、Play 経由の更新後の計測は未確認です。

English

On a Pixel 6, the first and query visited 1,809 dictionary readings after the English dictionary was ready. In one diagnostic run, word completion took 146 ms, with about 86 ms spent walking the trie. During rapid typing, the preceding an query could still be running when the next key arrived.

  • Reuse consecutive node labels and delimiters during trie traversal, prune ineligible word branches early, and use binary search to locate bit positions.
  • Stop English completion when a newer input cancels the current request.
  • Make the device harness match the candidate's consumed input length. For example, and offered for an can otherwise be counted as the result for and.

Pixel 6, Android 17, Full Standard Debug. Each cell is the median of three process starts, with the first word typed on the on-screen QWERTY keyboard at 85 ms intervals. Timing is from the final key release to the candidate strip's pre-draw.

First word Live conversion dev median Updated median
and Off 226 ms 202 ms
and On 246 ms 203 ms
and (40 ms interval) Off 290 ms 257 ms
  • The captured candidate lists matched in content and order across a ten-word typing sequence. The lists also matched when each of six other words was tested as the first word in a single cold run. Examples include the at 167 → 124 ms, open at 125 → 101 ms, and can at 134 → 156 ms.
  • All 20 English dictionary instrumentation tests and 13 focused unit tests passed. The corpus audit covered 16,343 distinct inputs in each of the conversion and legacy paths. Lite Standard Debug built successfully. The same Pixel 6 also passed a Lite typing smoke test for and, can, hello, and testing.
  • The dictionary-browser catalog count test fails on both dev and this branch, with 150 entries against an expectation of 39.
  • Five English dictionary, index, and grammar assets matched the Full 840 release bundle by SHA-256. Timing was measured with isolated debug builds. Timing after a Play-delivered update remains unverified.

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.

1 participant