Skip to content

Commit

Permalink
Python: remove unconditional sleep on spawn (#4010)
Browse files Browse the repository at this point in the history
Removes the unconditional `sleep(0.5)` on the spawn path in python,
improving latency.

This mimics what happens in the new Rust/C/C++ spawn APIs:

https://github.com/rerun-io/rerun/blob/3f41c3b3906147a0b9a4f27f7fe55a8fa59532ef/crates/re_sdk/src/recording_stream.rs#L1309-L1321
  • Loading branch information
teh-cmc authored Oct 26, 2023
1 parent e722331 commit 107c833
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rerun_py/rerun_sdk/rerun/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,14 @@ def spawn(
start_new_session=True,
)

# TODO(emilk): figure out a way to postpone connecting until the rerun viewer is listening.
# For example, wait until it prints "Hosting a SDK server over TCP at …"
sleep(0.5) # almost as good as waiting the correct amount of time
# Give the newly spawned Rerun Viewer some time to bind.
#
# NOTE: The timeout only covers the TCP handshake: if no process is bound to that address
# at all, the connection will fail immediately, irrelevant of the timeout configuration.
# For that reason we use an extra loop.
for _ in range(0, 5):
_check_for_existing_viewer(port)
sleep(0.1)

if connect:
_connect(f"127.0.0.1:{port}", recording=recording)

1 comment on commit 107c833

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 107c833 Previous: e722331 Ratio
batch_points_arrow/decode_total 53397 ns/iter (± 323) 42236 ns/iter (± 197) 1.26

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.