perf(redis): sort key tree names without lower-casing on every comparison
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- backend, performance
調査の方向性
lib/features/redis/redis_key_tree_engine.dart の RedisKeyTreeEngine.buildTree と、既存の RedisKeyTreeEngine テストから始めます。ルートのリーフ、フォルダー名、フォルダーのリーフがどのようにソートされるかを確認し、大文字小文字を無視すると同じ名前を含む、大文字と小文字が混在したテストを追加します。テストが通り、既存の同順位時の処理が維持され、このファイル内のどの comparator も toLowerCase() を呼び出さなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
RedisKeyTreeEngine.buildTree (lib/features/redis/redis_key_tree_engine.dart) sorts root leaves, folder names and each folder's leaves with
..sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()))
so toLowerCase() runs twice per comparison, i.e. O(n log n) string allocations for an O(n) amount of information. A single folder with tens of thousands of keys (the common case for session:* / cache:*) pays for it when the tree is built.
Measurements
Standalone Dart AOT, names like Cache_123456789_Key:
| Names | toLowerCase() per compare |
Decorated (lowercase once, sort pairs) |
|---|---|---|
| 5,000 | 3.2 ms | 1.5 ms |
| 50,000 | 47.5 ms | 24.7 ms |
About 2x. Not per-frame work, but it is a one-off pause of ~50 ms on a big keyspace that also happens on every refresh.
Solution
- Sort decorated pairs
(lower, node)(or precomputelowerNameon the node) so the lowercase string is created once per element. - Same ordering as today (case-insensitive compare of the label); keep the existing tie-break behaviour.
Acceptance
-
RedisKeyTreeEnginetests unchanged and green; add a case with mixed-case and equal-ignoring-case names to pin the order. - No
toLowerCase()inside a comparator in that file. - Optional: same pattern checked in other comparators (
grep -rn "toLowerCase().compareTo"inlib/).
- 主要言語
- Dart
- スター
- 23
- フォーク
- 1
- 平均マージ
- 31分
- マージ済み PR(30日)
- 570
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QueryaHub/Querya-Desktop のほかの issue
-
enhancement ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QueryaHub/Querya-Desktop#1689 ·
メンテナーはふだん 1 日以内に返信
-
ui(dialogs): make destructive query and DML preview dialogs adaptive and prevent table name overflowオープンbug frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
QueryaHub/Querya-Desktop#1642 ·
メンテナーはふだん 1 日以内に返信
-
bug error-handling settings
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
QueryaHub/Querya-Desktop#1637 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
QueryaHub/Querya-Desktop#1636 ·
メンテナーはふだん 1 日以内に返信
-
enhancement marketplace
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QueryaHub/Querya-Desktop#1635 ·
メンテナーはふだん 1 日以内に返信
QueryaHub/Querya-Desktop の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AppFlowy-IO/AppFlowy#9075 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
avdept/JellyBoxPlayer#375 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
basictech01/uniun#300 ·
メンテナーはふだん 1 日以内に返信
-
Listener that removes itself in its callback causes other listeners to miss updates対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
RevenueCat/purchases-flutter#1962 ·
メンテナーはふだん 1 日以内に返信