Skip to content

Stop building a path for every node of a serialized tree - #2976

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:serialized-tree-no-path
Open

vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:serialized-tree-no-path

Conversation

@vogella

@vogella vogella commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Writing and reading the workspace tree built an IPath for every node, only for the flatteners to check whether it was the root. On a large workspace that is a Path and a segment array copy per node of every tree in the delta chain, paid on each save and again on each startup. The serializers now pass a root flag instead, and the reader tracks the depth it needs to recognize project nodes, so the on-disk format is unchanged.

Serializing a tree of 615,000 nodes (600 projects), compared against master:

master this PR
write, allocated 56.2 MB 14.1 MB
read, allocated 110.4 MB 72.9 MB
write, C2 60 ms 53 ms
read, C2 61 ms 58 ms
write, C1 only 97 ms 64 ms
read, C1 only 101 ms 67 ms

The C1 row is the closer match for the startup read, which runs once before the JIT has warmed up.

Contributes to #2887

DataTreeWriter and DataTreeReader built an IPath for every node they
visited, only to hand it to the flattener. The flatteners only ever asked
whether it was the root, whose data holds the parent backpointer and must
not be written. This cost a Path plus a segment array copy for every node
of every tree in the delta chain, on each save and again on each startup.

Pass whether the node is the tree root instead. The reader tracks the depth
it needs to recognize a project node.

Serializing a tree of 615,000 nodes (600 projects) now allocates 14 MB
instead of 56 MB when writing and 73 MB instead of 110 MB when reading.
Writing is 12% faster with C2-compiled code, and both directions are about
a third faster with C1 only, which is closer to the one-time read at
startup.

Contributes to eclipse-platform#2887

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the serialized-tree-no-path branch from 8b9da24 to 3286899 Compare September 29, 2026 09:33
@vogella
vogella marked this pull request as ready for review September 29, 2026 10:22
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   57m 13s ⏱️ + 4m 40s
 4 836 tests ±0   4 814 ✅ ±0   22 💤 ±0  0 ❌ ±0 
12 399 runs  ±0  12 245 ✅ ±0  154 💤 ±0  0 ❌ ±0 

Results for commit 3286899. ± Comparison against base commit 5f5b145.

♻️ This comment has been updated with latest results.

@iloveeclipse

Copy link
Copy Markdown
Member

Serializing a tree of 615,000 nodes (600 projects), compared against master:

This table data is about heap memory used during read/write, nothing changes on disc, correct?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Required bundle-version increments and regression coverage for project renaming are missing.

Review effort: Balanced
Findings: 1 Medium severity · 2 Low severity

Open (3)
What changed in this PR

Optimizes workspace tree serialization by replacing per-node path construction with root/depth tracking while preserving the on-disk format.

Changes:

  • Passes root-state flags through tree serializers.
  • Uses reader depth to identify project nodes.
  • Updates flatteners and serialization test helpers.
File Description
ElementTreeSerializationTestHelper.java Adapts test flattener signatures.
IElementInfoFlattener.java Removes path parameters.
ElementTreeWriter.java Uses root flags when writing.
ElementTreeReader.java Uses root flags when reading.
SaveManager.java Adapts resource serialization methods.
IDataFlattener.java Replaces paths with root flags.
DataTreeWriter.java Avoids constructing descendant paths.
DataTreeReader.java Tracks traversal depth instead of paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vogella

vogella commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

This table data is about heap memory used during read/write, nothing changes on disc, correct?

Yes. from the PR description: the on-disk format is unchanged.

@vogella

vogella commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Test suggestion from Copilot is already covered by ProjectSnapshotTest.testLoadWithRename/testLoadWithRename2, which load a snapshot into a renamed project and assert the descendants keep their names.

The version suggestion were wrong, we have our automatic version updates handled by GH actions.

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.

3 participants