Open
perf: optimize completion path across all layers#247
Conversation
Agent-Logs-Url: https://github.com/vim-skk/skkeleton/sessions/415d2840-5890-47ba-a154-1f01f42011a5 Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/vim-skk/skkeleton/sessions/415d2840-5890-47ba-a154-1f01f42011a5 Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>
Shougo
approved these changes
May 8, 2026
Shougo
marked this pull request as ready for review
May 8, 2026 09:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
前回の分析で特定した補完パス全体のボトルネックを一括で修正します。
Changes
user_dictionary.ts—getRanksの O(N) スキャン除去(改善案 C + I)Setに収め、#rankの全エントリ (entries()→ 配列展開 →filter) をスキャン#rank.get(c)で O(1) ルックアップSetで排除deno_kv.ts—#searchByPrefixの get + list 並列化(改善案 E)db.get()(完全一致)とdb.list()(前方一致)は独立クエリPromise.allで並列発行し、レイテンシを約半分に削減main.ts— 統合ディスパッチャ追加(改善案 A + G)getCompletionResultWithRanks:getCompletionResultとgetRanksを 1 RPC に集約getCandidatesBatch: N 個の見出しをまとめて照会し 1 RPC に集約(skk_server の単一 readCallback との互換性維持のため内部は逐次)@ddc-sources/skkeleton/main.ts— RPC 2往復 → 1往復(改善案 A + B)gather()をgetCompletionResultWithRanks単一呼び出しに変更candidates.sort(…localeCompare…)は直後の rank ソートで上書きされる重複であったため除去@ddc-sources/skkeleton_okuri/main.ts— N 回 dispatch → 1 回(改善案 G)okuriSplitsで得た全 midashi をgetCandidatesBatchで一括照会@ddc-sources/skkeleton_okuri/okurisplits.ts— 可読性改善(改善案 H)Array.from(Array(n), …) + mapを単純なforループに置換(動作等価)Backward Compatibility
getCompletionResult,getRanks,getCandidates) は全て残存。外部プラグインとの互換性を維持。