Bottleneck reading XML element value
- 主要语言
- C#
- 星标
- 14
- 派生
- 21
- PR 合并指标
- 30 天内没有已合并 PR
描述
Up to 40-50% of the time can be spent in this method
https://github.com/carlossanlop/DocsPortingTool/blob/main/Libraries/XmlHelper.cs#L134-L143
It is simply reading the value of an element, but it needs to do it literally, ie., any CDATA wrapping it, etc, so it can't just get Value. This forces creating an Xml text writer, etc - it's very slow.
I added in a comment there an alternative way of doing this based on the stackoverflow post below
https://stackoverflow.com/questions/3793/best-way-to-get-innerxml-of-an-xelement
I didn't try every scenario but it seems to produce the same result albeit with sometimes different line wraps (possibly an improvement). It's about twice as fast so if it's good enough it could be swapped for what is there now.
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 Libraries/XmlHelper.cs 的第 134–143 行开始,将当前的 XML 文本写入器实现与 issue 和链接的 Stack Overflow 帖子中描述的替代方案进行比较。检查具有代表性的 XML 案例,包括 CDATA,并对这些方案进行基准测试;当更快的实现能够保留所需的元素文本输出时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- performance, tooling
- Issue 类型
- 重构
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100