Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#1,551 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter, redis
Lĩnh vực
backend, performance

Hướng nghiên cứu

Bắt đầu với RedisKeyTreeEngine.buildTree trong lib/features/redis/redis_key_tree_engine.dart và các bài kiểm tra hiện có của RedisKeyTreeEngine. Kiểm tra cách sắp xếp các lá gốc, tên thư mục và lá trong thư mục, sau đó thêm một bài kiểm tra có chữ hoa và chữ thường lẫn nhau, bao gồm các tên giống nhau khi không phân biệt chữ hoa chữ thường. Hoàn tất khi các bài kiểm tra chạy thành công, giữ nguyên cách xử lý khi bằng nhau hiện có và không có comparator nào trong tệp đó gọi toLowerCase().

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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/).
Ngôn ngữ chính
Dart
Star
23
Fork
1
Merge trung bình
32 phút
Pull request đã merge (30 ngày)
537

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QueryaHub/Querya-Desktop

Tất cả issue của QueryaHub/Querya-Desktop

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.