Skip to content

Cache env and param pointers in InPlaceExecutionContext#462

Open
stanbot8 wants to merge 1 commit intoBioDynaMo:masterfrom
stanbot8:perf/cache-exec-ctxt-params
Open

Cache env and param pointers in InPlaceExecutionContext#462
stanbot8 wants to merge 1 commit intoBioDynaMo:masterfrom
stanbot8:perf/cache-exec-ctxt-params

Conversation

@stanbot8
Copy link
Copy Markdown
Contributor

@stanbot8 stanbot8 commented Mar 5, 2026

Summary

  • Caches Environment* and Param* pointers once per agent-ops phase in SetupAgentOpsAll, eliminating two Simulation::GetActive() lookups per agent per iteration in Execute
  • Falls back to Simulation::GetActive() when cached pointers are null (e.g. when Execute is called outside the agent-ops phase, as in CopyExecutionContext)

Test plan

  • Existing unit tests pass (make check)
  • Verified with profiling that Simulation::GetActive() calls in Execute are eliminated during normal iteration

@sportokalidis
Copy link
Copy Markdown
Contributor

Hi @stanbot8,

Thanks for the contribution! I’ll review the changes and get back to you.

In the meantime: the CI issue that previously prevented macos-system-ci and ubuntu-system-ci from running has been fixed on main.

Could you please update your PR branch with the latest main (merge main into your branch, or rebase onto main) and push? That should trigger the missing system CI workflows on this PR.

@stanbot8 stanbot8 force-pushed the perf/cache-exec-ctxt-params branch from ef5e85f to a960c6c Compare March 11, 2026 16:34
Execute() called Simulation::GetActive()->GetEnvironment() and
GetParam() for every agent every step. These pointers are stable
within an agent-ops phase, so cache them once in SetupAgentOpsAll
and reuse the cached values in Execute. Eliminates two pointer
chases per agent per step.
@stanbot8 stanbot8 force-pushed the perf/cache-exec-ctxt-params branch from a960c6c to 6b7632e Compare March 12, 2026 14:54
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.

2 participants