High compile time of crates using sqlparser(codegen phase) - any way to reduce generated code?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- performance
调研方向
首先使用 cargo llvm-lines 重现报告中的编译配置,并检查为报告中提到的 AST 类型生成的 VisitMut 实现。比较采用任何方案前后的代码生成规模和编译时间;在不破坏 visitor 行为的情况下,证明生成代码量或编译时间有所减少,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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%) <sqlparser::ast::Statement as sqlparser::ast::visitor::VisitMut>::visit
163970 (7.5%, 17.6%) 1995 (6.3%, 6.4%) <alloc::vec::Vec<T> as sqlparser::ast::visitor::VisitMut>::visit
117960 (5.4%, 23.0%) 3654 (11.6%, 18.0%) <core::option::Option<T> as sqlparser::ast::visitor::VisitMut>::visit
76507 (3.5%, 26.5%) 21 (0.1%, 18.0%) <sqlparser::ast::Expr as sqlparser::ast::visitor::VisitMut>::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?
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 774
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 19
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-sqlparser-rs 的其他 Issue
-
难度 2/5 1-2 天 新手友好度 72/100
apache/datafusion-sqlparser-rs#2495 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-sqlparser-rs#2461 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 73/100
apache/datafusion-sqlparser-rs#2407 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
apache/datafusion-sqlparser-rs#2393 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
apache/datafusion-sqlparser-rs#2390 · 1 条评论 ·
查看 apache/datafusion-sqlparser-rs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
stratum-mining/stratum#2404 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
bug team:backend track:services-maintenance
难度 2/5 1-3 小时 新手友好度 78/100
cowprotocol/services#4950 ·