Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Opening a compare editor blocks the UI and reads the input contents repeatedly

未关闭
#2,795 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
java

调研方向

首先跟踪 org.eclipse.compare 中 compare-editor 的打开路径,包括 StorageTypedElement、CompareUIPlugin.canShowInUnifiedDiff 和 UnifiedDiffManager.open。先运行 issue 中描述的计数和计时测试。完成的标准是:测量涵盖重复读取和 UI 阻塞,移除冗余工作,并且 unified diff 和初始 diff 的处理遵循预期的后台作业模式。

由索引模型根据 Issue 内容生成。

描述

performance

Opening a compare editor (for example from the Git History or Git Staging view) takes long, even for small files. The same applies to the new unified diff display.

Tracing the open path in org.eclipse.compare shows the delay is structural, not in the diff algorithm (see also #2575, where a DocLineComparator micro-optimization did not help):

  • The input contents are read repeatedly during a single open. A new counting test measures 15 getContents() calls per side for one editor open. With EGit inputs each call re-inflates the blob since StorageTypedElement only buffers the storage handle.
  • After the "Comparing..." job, everything else runs on the UI thread inside createContents. Timing tests confirm time-to-text equals time-to-diff, so nothing is visible until the diff completes (about 190 ms for 5000 lines with 100 changes, about 310 ms for 50000 lines, measured on Linux/Xvfb).
  • With the unified diff preference enabled, CompareUIPlugin.canShowInUnifiedDiff runs the full prepareInput synchronously on the UI thread with a NullProgressMonitor, builds a throwaway TextMergeViewer on an invisible Shell, and UnifiedDiffManager.open then computes a second diff inline on the UI thread.

I plan to address this incrementally: measurable tests first (deterministic call counters plus repeated-run timing medians, since the old org.eclipse.test.performance-based tests assert nothing without the performance database), then removing the redundant lookups and reads, then moving the unified path onto the same background-job pattern as the classic editor, and finally making the initial diff asynchronous so the text shows immediately.

See also #121 for a related problem after the compare editor opens.

主要语言
Java
星标
165
派生
174
平均合并
4 天 11 分钟
30 天内合并 PR
43

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

eclipse-platform/eclipse.platform 的其他 Issue

查看 eclipse-platform/eclipse.platform 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。