Comprehension macros are O(n²) in cel-rust 0.14.5; upstream fix for `map` is on master
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- documentation, performance, release, testing
Direzione di ricerca
Attendi cel-rust 0.14.6 o 0.15, quindi aggiornalo e riesegui i casi cs/c del bench.py del prototipo #45. Verifica se la correzione upstream di map copre anche filter, all, exists ed exists_one; aggiungi il controllo delle prestazioni con 10.000 elementi in tests/test_performance_verification.py e aggiorna il riferimento della libreria standard se le comprensioni di liste di grandi dimensioni rimangono lente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.pythat pins a comprehension over a 10,000-element list under a generous bound (say 200 ms) so a regression is caught. - If
filteris 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).
- Lingua principale
- Python
- Stelle
- 43
- Fork
- 4
- Merge medio
- 9h 57m
- PR unite (30g)
- 14
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hardbyte/python-common-expression-language
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di hardbyte/python-common-expression-language
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/skills#1811 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
speaches-ai/speaches#678 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
datalayer/mcp-compose#42 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
UKGovernmentBEIS/inspect_evals#2523 ·