Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#1,551 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter, redis

Direzione di ricerca

Inizia da RedisKeyTreeEngine.buildTree in lib/features/redis/redis_key_tree_engine.dart e dai test esistenti di RedisKeyTreeEngine. Verifica come vengono ordinati gli elementi foglia radice, i nomi delle cartelle e gli elementi foglia delle cartelle, poi aggiungi un test con maiuscole e minuscole mescolate che includa nomi uguali ignorando le maiuscole. Il lavoro è completato quando i test passano, il comportamento esistente di risoluzione delle parità è preservato e nessun comparatore in quel file chiama toLowerCase().

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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/).
Lingua principale
Dart
Stelle
23
Fork
1
Merge medio
32m
PR unite (30g)
537

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QueryaHub/Querya-Desktop

Tutte le issue di QueryaHub/Querya-Desktop

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.