Optimize xml_path() and xml_find_all() for large node sets
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- r
- 领域
- performance
调研方向
Start with the xml_path() and xml_find_all.xml_node() entry points, then review the regression tests described in the issue. Confirm that batch xml_path() output matches per-node output and that single-context XPath node sets remain unique. Benchmark large node sets and attribute result sets to verify the optimization preserves semantics and improves materialization time.
由索引模型根据 Issue 内容生成。
描述
xml_path() and xml_find_all() can spend substantial time in wrapper-side work when operating on large node sets.
I have a local branch with two general optimizations, both intended to preserve existing semantics:
- Speed up
xml_path()for largexml_nodesets by caching reusable ancestor paths within a single call. - Speed up
xml_find_all.xml_node()materialization by avoiding an unnecessary duplicate pass for single-context XPath node sets and reducing per-node R object construction overhead.
Is this a direction you would be open to reviewing as a PR?
Isolated benchmark results from my local machine:
-
xml_path()on a synthetic node set with 124,001 nodes:- before: ~0.77s
- after: ~0.07s
-
xml_path()on a large real-world XML bundle with 415,022 selected nodes:- before: ~2.43s
- after: ~0.28s
-
xml_find_all()/ XPath result materialization on large attribute result sets:- synthetic 300k attributes: roughly 1.5-2x faster in the materialization-heavy path
- real-world XML bundle,
//@*, 155,009 attributes: roughly 1.6-2x faster in isolated runs
The changes are not specific to any particular XML schema or downstream package. They target repeated ancestor path construction and large XPath result materialization.
I added regression tests comparing batch xml_path() output to per-node xml_path() output, and checking that single-context xml_find_all() XPath node sets remain unique.
- 主要语言
- R
- 星标
- 227
- 派生
- 86
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
r-lib/xml2 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 67/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 45/100
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
Bioconductor/BiocParallel#289 ·
-
automation
难度 2/5 1-3 小时 新手友好度 68/100
waldronlab/BugSigDBcuration#2224 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
merliseclyde/BAS#118 ·