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

perf(redis): sort key tree names without lower-casing on every comparison

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

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

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

評価

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

調査の方向性

lib/features/redis/redis_key_tree_engine.dart の RedisKeyTreeEngine.buildTree と、既存の RedisKeyTreeEngine テストから始めます。ルートのリーフ、フォルダー名、フォルダーのリーフがどのようにソートされるかを確認し、大文字小文字を無視すると同じ名前を含む、大文字と小文字が混在したテストを追加します。テストが通り、既存の同順位時の処理が維持され、このファイル内のどの comparator も toLowerCase() を呼び出さなければ完了です。

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

説明

backend enhancement P3 performance
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 precompute lowerName on 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
  • RedisKeyTreeEngine tests 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" in lib/).
主要言語
Dart
スター
23
フォーク
1
平均マージ
31分
マージ済み PR(30日)
570

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

QueryaHub/Querya-Desktop のほかの issue

QueryaHub/Querya-Desktop の issue をすべて見る

似ている issue

Dart の issue をもっと見る

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

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