Skip to content

Conversation

@loichyan
Copy link
Owner

Generally, adding tmux calls will also increase the latency when opening a popup window, as shown below:

Before this PR:

$ hyperfine --shell=/bin/sh --warmup=3 "./src/toggle.sh -E --before-open='run true' --on-init='detach' --after-close='run true'"
Benchmark 1: ./src/toggle.sh -E --before-open='run true' --on-init='detach' --after-close='run true'
  Time (mean ± σ):      64.1 ms ±  17.8 ms    [User: 17.1 ms, System: 24.2 ms]
  Range (min … max):    38.5 ms …  94.8 ms    70 runs

After:

$ hyperfine --shell=/bin/sh --warmup=3 "./src/toggle.sh -E --before-open='run true' --on-init='detach' --after-close='run true'"
Benchmark 1: ./src/toggle.sh -E --before-open='run true' --on-init='detach' --after-close='run true'
  Time (mean ± σ):      39.7 ms ±   2.9 ms    [User: 11.7 ms, System: 12.0 ms]
  Range (min … max):    33.1 ms …  45.4 ms    82 runs

A potential downside of this PR is that the commands specified in a hook must not affect the subsequent tmux commands. Since the two hooks subject to this limitation are rarely used, and few tmux commands have such an influence, it is acceptable to proceed.

@loichyan loichyan merged commit b45fc40 into main Aug 14, 2025
@loichyan loichyan deleted the perf/single-exec branch August 14, 2025 00:22
@loichyan loichyan mentioned this pull request Aug 14, 2025
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