Skip to content

Cache runout script pause detection - #28740

Merged
thinkyhead merged 2 commits into
MarlinFirmware:bugfix-2.1.xfrom
bobkaren1975-spec:perf/runout-script-cache
Oct 23, 2026
Merged

thinkyhead merged 2 commits into
MarlinFirmware:bugfix-2.1.xfrom
bobkaren1975-spec:perf/runout-script-cache

Conversation

@bobkaren1975-spec

Copy link
Copy Markdown
Contributor

Summary

Avoid repeated strstr() checks against FILAMENT_RUNOUT_SCRIPT inside the filament runout handler by caching the pause/park decision once at compile time.

This keeps the hot path minimal while preserving behavior for M600/M125/M25-based runout scripts.

Why this is a good optimization

  • Very low code churn
  • Constant-time check instead of repeated string scanning in a frequently executed handler
  • No behavioral change for existing script configurations

Validation

  • git diff --check for whitespace and patch integrity
  • Attempted targeted compile validation with PlatformIO, but the local environment lacked a configured PlatformIO project in the working directory and the repo was not opened as the project root

Robert and others added 2 commits October 23, 2026 13:28
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@thinkyhead
thinkyhead force-pushed the perf/runout-script-cache branch from 0fd4839 to ac8a791 Compare October 23, 2026 17:46
@thinkyhead

Copy link
Copy Markdown
Member

This actually has zero effect on the generated code because GCC is smart and can already see that it is generating an invariant bool. However, we can add static constexpr to get nervous coding agents to chill out.

@thinkyhead
thinkyhead merged commit d4eb384 into MarlinFirmware:bugfix-2.1.x Oct 23, 2026
thinkyhead added a commit that referenced this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants