apache / apache/datafusion-sqlparser-rs

High compile time of crates using sqlparser(codegen phase) - any way to reduce generated code?​​

オープン
#2,066 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
3.5k
フォーク
772
平均マージ
4日 9時間
マージ済み PR(30日)
17

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず cargo llvm-lines を使って報告されたコンパイルプロファイルを再現し、報告で名前が挙げられている AST 型に対して生成された VisitMut 実装を調査します。各アプローチの前後でコード生成の規模とコンパイル時間を比較します。生成されるコードまたはコンパイル時間の削減が実証され、visitor の動作を壊していなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
performance
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。