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

Comprehension macros are O(n²) in cel-rust 0.14.5; upstream fix for `map` is on master

Đang mở
#57 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, rust

Hướng nghiên cứu

Chờ cel-rust 0.14.6 hoặc 0.15, sau đó nâng cấp nó và chạy lại các trường hợp cs/c trong bench.py của prototype #45. Kiểm tra xem bản sửa lỗi upstream cho map có bao phủ cả filter, all, exists và exists_one hay không; thêm kiểm tra hiệu năng với 10.000 phần tử vào tests/test_performance_verification.py và cập nhật tham chiếu thư viện chuẩn nếu các list comprehension lớn vẫn chậm.

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

Mô tả

enhancement

Found while benchmarking for #45. Executing items.filter(i, i % 3 == 0).map(i, i * i).size() against a Context holding an int list scales quadratically with the list length (release build, min of repeats):

elements time per execute
1,000 17 ms
2,000 66 ms
4,000 251 ms
8,000 940 ms
20,000 5.8 s

Each doubling costs ~4×. cel-rust 0.14.5's comprehension macros rebuild the accumulator list on every append (Value::List is an Arc<Vec<_>>, so appending clones the vector), which makes map/filter over anything beyond a few thousand elements unusable. Nothing in this wrapper contributes; a dict context and a Context behave identically.

Upstream already has the fix for map on master, unreleased: cel-rust/cel-rust#341 "perf(macros): map mutates List in place" (merged 2026-09-13, on top of "perf(map): Added mutable List used in map"). It is not clear from the PR title whether filter, all, exists and exists_one got the same treatment.

To do

  • When the next cel-rust release (0.14.6 or 0.15) ships, bump and re-run the table above; add a test in tests/test_performance_verification.py that pins a comprehension over a 10,000-element list under a generous bound (say 200 ms) so a regression is caught.
  • If filter is still quadratic after the bump, raise it upstream with the numbers.
  • Until then the standard-library reference should say that comprehensions over large lists are slow in the current cel-rust, since policy engines routinely filter lists of thousands of records.

Benchmark script: the cs/c cases in the #45 prototype's bench.py (measured on 4 cores).

Ngôn ngữ chính
Python
Star
43
Fork
4
Merge trung bình
12 giờ 37 phút
Pull request đã merge (30 ngày)
11

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 hardbyte/python-common-expression-language

Tất cả issue của hardbyte/python-common-expression-language

Issue tương tự

Thêm issue về Python

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.