Skip to content

perf: process kill retry, PID jitter, daemon runtime#627

Open
Wirasm wants to merge 2 commits intomainfrom
kild/perf-optimizations
Open

perf: process kill retry, PID jitter, daemon runtime#627
Wirasm wants to merge 2 commits intomainfrom
kild/perf-optimizations

Conversation

@Wirasm
Copy link
Owner

@Wirasm Wirasm commented Mar 4, 2026

Summary

  • Add process.wait() after kill() to verify termination and prevent zombie processes
  • Add +/-20% random jitter to PID file polling interval to prevent thundering herd when multiple kild create commands run simultaneously
  • Switch daemon from multi-threaded tokio runtime to current_thread since it's I/O-bound with low concurrency

Items 1 (Cow newtypes), 2 (git caching — each call opens a different worktree path), and 6 (HashMap keys are tiny pane IDs) from #478 were evaluated and skipped as YAGNI for this codebase.

Closes #478

Test plan

  • cargo fmt --check passes
  • cargo clippy --all -- -D warnings passes
  • cargo test --all passes (2 pre-existing failures in resolve_self_branch unrelated to this PR)
  • Manual test: kild create + kild stop to verify process cleanup
  • Manual test: concurrent kild create commands to verify jitter prevents lock contention

Wirasm added 2 commits March 4, 2026 17:24
- Add process.wait() after kill() to verify termination and prevent
  zombie processes
- Add +/-20% random jitter to PID file polling interval to prevent
  thundering herd when multiple kild create commands run simultaneously
- Switch daemon from multi-threaded tokio runtime to current_thread
  since it's I/O-bound with low concurrency (PTY reads + IPC)

Closes #478
- Replace process.wait() with bounded 500ms poll loop to avoid blocking
  indefinitely on uninterruptible sleep
- Use PID-based jitter instead of SystemTime nanos which are correlated
  across simultaneous launches
- Revert current_thread runtime: daemon multiplexes PTYs + IPC across
  multiple sessions, single-threaded would stall all sessions on any
  slow operation
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.

perf: minor optimizations — string cloning, git caching, process kill retry, PID jitter

1 participant