Skip to content

Commit

Permalink
fix(terminal): only refresh process specifics for given PID in get_cw…
Browse files Browse the repository at this point in the history
…d() (zellij-org#3472)

Update `get_cwd()` to only refresh process specifics for the given PID,
matching the `get_cwds()` implementation.

This significantly reduces the latency of opening a new Pane or Tab.

On a 64-core Threadripper system, this reduces the latency of
`get_cwd()` from 850ms to 1ms. On an 8-core Ryzen system, the
improvement is smaller, but still perceptible.
  • Loading branch information
Hylian authored and Tomcat-42 committed Nov 9, 2024
1 parent 27fb46b commit 5ffca92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zellij-server/src/os_input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ impl ServerOsApi for ServerOsInputOutput {
let mut system_info = System::new();
// Update by minimizing information.
// See https://docs.rs/sysinfo/0.22.5/sysinfo/struct.ProcessRefreshKind.html#
system_info.refresh_processes_specifics(ProcessRefreshKind::default());
system_info.refresh_process_specifics(pid.into(), ProcessRefreshKind::default());

if let Some(process) = system_info.process(pid.into()) {
let cwd = process.cwd();
Expand Down

0 comments on commit 5ffca92

Please sign in to comment.