Skip to content

Read the compared contents once, in the background - #2840

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:compare-prefetch-contents
Open

Read the compared contents once, in the background#2840
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:compare-prefetch-contents

Conversation

@vogella

@vogella vogella commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Opening a compare editor read each side three times: once for content type detection, once for the text heuristic and once for the document shown in the viewer. All three happened on the UI thread and each one paid whatever the provider charges for producing a stream; for an EGit revision that means inflating the blob and running the smudge and EOL filters three times over.

The background job that prepares the input now reads the contents once, and both the sniffing and the merge viewer are served from that. Elements backed by a shared document are skipped, since those are served from the file buffer and never read a stream anyway, which is exactly the local side of a typical comparison. An entry is dropped as soon as it became a document, so at most one input's contents are held at a time.

CompareOpenEfficiencyTest's bound drops from 3 reads per side to 1, and I verified that the bound really depends on the prefetch: with the prefetch call removed the test reports 3 again.

Contributes to #2795

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  +    54      54 suites  +54   59m 47s ⏱️ + 59m 47s
 4 701 tests + 4 701   4 677 ✅ + 4 677   22 💤 + 22  2 ❌ +2 
11 997 runs  +11 997  11 842 ✅ +11 842  153 💤 +153  2 ❌ +2 

For more details on these failures, see this check.

Results for commit fee6afc. ± Comparison against base commit 196a2b9.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the compare-prefetch-contents branch from 9cdd11b to c8e3000 Compare July 31, 2026 08:10
Opening a compare editor read each side three times: once for content type
detection, once for the text heuristic and once for the document shown in
the viewer, all three on the UI thread and each one paying whatever the
provider charges for a stream. For an EGit revision that means inflating
the blob and running the smudge filters three times over.

The background job that prepares the input now reads the contents once and
the sniffing and the merge viewer are served from that. Elements backed by
a shared document are skipped, since those come from the file buffer and
never read a stream anyway. An entry is dropped as soon as it became a
document, so at most one input's contents are held at a time.

CompareOpenEfficiencyTest's bound drops from 3 reads per side to 1.

Contributes to eclipse-platform#2795
@vogella
vogella force-pushed the compare-prefetch-contents branch from c8e3000 to fee6afc Compare July 31, 2026 14:34
@vogella
vogella marked this pull request as ready for review July 31, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant