apache / apache/datafusion-sqlparser-rs
High compile time of crates using sqlparser(codegen phase) - any way to reduce generated code?
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 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
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100