apache / apache/datafusion-sqlparser-rs
High compile time of crates using sqlparser(codegen phase) - any way to reduce generated code?
- Vorherrschende Sprache
- Rust
- Sterne
- 3.5k
- Forks
- 772
- Ø Merge
- 4 T. 9 Std.
- Gemergte PRs (30 T.)
- 17
Beschreibung
In my project, some crates have very long compilation times (e.g., 40-50 seconds, with the codegen phase accounting for 70%-90% of that time). I suspect these crates are slow to compile due to their dependency on sqlparser.
I analyzed the compilation of one such crate using cargo llvm-lines. The top functions by lines are listed below:
```
Lines Copies Function name
----- ------ -------------
2180708 31532 (TOTAL)
220326 (10.1%, 10.1%) 21 (0.1%, 0.1%) ::visit
163970 (7.5%, 17.6%) 1995 (6.3%, 6.4%) as sqlparser::ast::visitor::VisitMut>::visit
117960 (5.4%, 23.0%) 3654 (11.6%, 18.0%) as sqlparser::ast::visitor::VisitMut>::visit
76507 (3.5%, 26.5%) 21 (0.1%, 18.0%) ::visit
```
As shown, the visitor trait implementations for the AST types generate a significant amount of code. Is there any way to reduce the code generation footprint of sqlparser?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, das gemeldete Kompilierungsprofil mit cargo llvm-lines zu reproduzieren, und untersuche die generierten VisitMut-Implementierungen für die im Bericht genannten AST-Typen. Vergleiche den Codegen-Umfang und die Kompilierungszeit vor und nach jedem Ansatz; abgeschlossen bedeutet eine nachgewiesene Verringerung des generierten Codes oder der Kompilierungszeit, ohne das Besucherverhalten zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- performance
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100