FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

perf: size the Gizmo clone map after the previous clone by larsbeck · Pull Request #2729 · TimefoldAI/timefold-solver · GitHub

Repository navigation

perf: size the Gizmo clone map after the previous clone - #2729

Open
larsbeck wants to merge 2 commits into
mainfrom
perf-gizmo-clone-map-sizing
Open

larsbeck wants to merge 2 commits into
mainfrom
perf-gizmo-clone-map-sizing

Conversation

larsbeck commented Oct 6, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

The Gizmo-generated solution cloner started every clone with a default-sized IdentityHashMap. Cloning a large solution
therefore rehashed the map about a dozen times per clone, and a clone happens on every new best solution.
FieldAccessingSolutionCloner already sizes its map from earlier clones; the generated cloner now does the same: it keeps
the size of its previous clone map in an instance field and starts the next map at that size.

Measured in CPU profiles (JFR, solver thread during local search):

  • Employee scheduling, 110k shifts: the map resize was about 9% of each clone.
  • Field service routing, 29k visits: IdentityHashMap.resize was about 2.5% of the solver thread, which spends about 20%
    in best-solution cloning.

This was part of a field service routing benchmark on the staging platform (model changes:
TimefoldAI/timefold-field-service-routing#1519), together with the identity-set clear fix that is now on main
(#2726).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XmKTGxVTeDoPGmxW4jmxKV

The generated cloner started every clone with a default-sized IdentityHashMap,
so cloning a 110k-entity solution rehashed the map about a dozen times; that was
~9% of each clone. FieldAccessingSolutionCloner already sizes its map from
earlier clones. The generated cloner now keeps the size of its previous clone
map in an instance field and starts the next map at that size.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmFY9fXcywg9CE9ufNXt5f

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot review overview

🟡 Changes recommended

The new shared mutable field must preserve the cloner’s thread-safety contract.

Review effort: Balanced
Findings: 1

Open (1) What changed in this PR

Optimizes Gizmo solution cloning by sizing each clone map from the previous clone.

Changes:

  • Tracks the previous clone’s object count.
  • Pre-sizes subsequent IdentityHashMap instances.
File Description
GizmoSolutionClonerImplementor.java Adds adaptive clone-map sizing.

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

SolutionCloner implementations must be thread-safe after initialization,
because partitioned search shares one cloner between part threads.
FieldAccessingSolutionCloner keeps its size hint in an AtomicInteger;
the generated cloner now declares its field volatile. The hint is only
written, never read and modified, so visibility is all it needs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmKTGxVTeDoPGmxW4jmxKV
Copilot AI balanced review requested due to automatic review settings October 6, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot review overview

🟡 Changes recommended

The new generated caching behavior lacks focused automated coverage.

Review effort: Balanced
Findings: 1

Open (1) Resolved since last review (1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot review overview

🟢 Approval recommended

The focused optimization is correct, thread-safe, and consistent with existing cloner behavior.

Review effort: Balanced
Findings: None

Resolved since last review (1)

This branch was successfully deployed

1 active deployment
internal — cd5687e8 Deployed Oct 6, 2026 by larsbeck via approval_required #4977
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL