From d5fabf77757240d2b98e5ce1381f4e76e8e0e515 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:05:00 +0000 Subject: [PATCH] Docs: update bolt.md with CC3D semantics learnings Co-authored-by: NoWon1 <126711057+NoWon1@users.noreply.github.com> --- .jules/bolt.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.jules/bolt.md b/.jules/bolt.md index 133dfbf..d1b5d22 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -4,3 +4,6 @@ ## 2026-08-30 - Pre-calculate nested spatial loops bounds in CC3D **Learning:** Checking boundary conditions (e.g., `0 <= x < self.dim.x`) during *every single iteration* inside tightly nested loops degrades performance in operations executed frequently per MCS (like cell removals or checking neighborhood contacts). **Action:** When a bounding box is known relative to a central coordinate, use `min` and `max` with grid dimensions *outside* the loop to strictly bound the `range()` generators, completely eliminating conditionally evaluated boundary checks inside the innermost loop body. +## 2023-10-27 - CC3D Steppable Safety and Semantics +**Learning:** In CompuCell3D, attempting to optimize `O(N)` loops by combining sequential physics operations (like secretion then degradation) into a single iteration over `self.cell_list` alters the fundamental physics of the simulation by interleaving state updates. Additionally, `self.cell_list` is dynamic; removing dictionary existence checks for `cell.id` on hot paths causes `KeyError` regressions when cells divide. +**Action:** Do not combine sequential loop operations that compute distinct simulation steps. Never remove `cell.id` initialization checks from state dictionaries in hot paths, as cells are dynamically created during the simulation.