Skip to content

Commit

Permalink
Always log the primary component last so it is joined properly (#1217)
Browse files Browse the repository at this point in the history
* Always log splats before the primary component
* Make comment clear that the important thing is primary last not splat first
  • Loading branch information
jleibs authored Feb 12, 2023
1 parent afec6b0 commit a5a6a01
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 37 deletions.
8 changes: 5 additions & 3 deletions crates/re_sdk/src/msg_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,17 @@ impl MsgSender {
pub fn send(self, session: &mut Session) -> Result<(), MsgSenderError> {
let [msg_standard, msg_transforms, msg_splats] = self.into_messages()?;

if let Some(msg_standard) = msg_standard {
session.send(LogMsg::ArrowMsg(msg_standard.try_into()?));
}
if let Some(msg_transforms) = msg_transforms {
session.send(LogMsg::ArrowMsg(msg_transforms.try_into()?));
}
if let Some(msg_splats) = msg_splats {
session.send(LogMsg::ArrowMsg(msg_splats.try_into()?));
}
// Always the primary component last so range-based queries will include the other data. See(#1215)
// Since the primary component can't be splatted it must be in msg_standard
if let Some(msg_standard) = msg_standard {
session.send(LogMsg::ArrowMsg(msg_standard.try_into()?));
}

Ok(())
}
Expand Down
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def log_arrow(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/bounding_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ def log_obb(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/extension_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ def log_extension_components(

_add_extension_components(instanced, splats, ext, identifiers_np)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)
14 changes: 8 additions & 6 deletions rerun_py/rerun_sdk/rerun/log/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ def log_line_strip(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)


def log_line_segments(
entity_path: str,
Expand Down Expand Up @@ -174,9 +175,10 @@ def log_line_segments(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)
12 changes: 7 additions & 5 deletions rerun_py/rerun_sdk/rerun/log/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ def log_point(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)


def log_points(
entity_path: str,
Expand Down Expand Up @@ -244,8 +245,9 @@ def log_points(
if ext:
_add_extension_components(comps[0], comps[1], ext, identifiers_np)

bindings.log_arrow_msg(entity_path, components=comps[0], timeless=timeless)

if comps[1]:
comps[1]["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=comps[1], timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
bindings.log_arrow_msg(entity_path, components=comps[0], timeless=timeless)
12 changes: 7 additions & 5 deletions rerun_py/rerun_sdk/rerun/log/rects.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ def log_rect(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)


def log_rects(
entity_path: str,
Expand Down Expand Up @@ -190,8 +191,9 @@ def log_rects(
if ext:
_add_extension_components(comps[0], comps[1], ext, identifiers_np)

bindings.log_arrow_msg(entity_path, components=comps[0], timeless=timeless)

if comps[1]:
comps[1]["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=comps[1], timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
bindings.log_arrow_msg(entity_path, components=comps[0], timeless=timeless)
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ def log_scalar(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=False)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=False)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=False)
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ def _log_tensor(
if ext:
_add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)
7 changes: 4 additions & 3 deletions rerun_py/rerun_sdk/rerun/log/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ def log_text_entry(
if ext:
rerun.log.extension_components._add_extension_components(instanced, splats, ext, None)

if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

if splats:
splats["rerun.instance_key"] = InstanceArray.splat()
bindings.log_arrow_msg(entity_path, components=splats, timeless=timeless)

# Always the primary component last so range-based queries will include the other data. See(#1215)
if instanced:
bindings.log_arrow_msg(entity_path, components=instanced, timeless=timeless)

1 comment on commit a5a6a01

@github-actions
Copy link

Choose a reason for hiding this comment

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

Rust Benchmark

Benchmark suite Current: a5a6a01 Previous: 42803fc Ratio
datastore/insert/batch/rects/insert 565624 ns/iter (± 30986) 542080 ns/iter (± 4778) 1.04
datastore/latest_at/batch/rects/query 1767 ns/iter (± 74) 1744 ns/iter (± 11) 1.01
datastore/latest_at/missing_components/primary 361 ns/iter (± 21) 361 ns/iter (± 1) 1
datastore/latest_at/missing_components/secondaries 432 ns/iter (± 18) 422 ns/iter (± 4) 1.02
datastore/range/batch/rects/query 150902 ns/iter (± 5189) 145892 ns/iter (± 1500) 1.03
mono_points_arrow/generate_message_bundles 42430752 ns/iter (± 2268873) 43813788 ns/iter (± 1216226) 0.97
mono_points_arrow/generate_messages 127902158 ns/iter (± 4798511) 124674795 ns/iter (± 1329392) 1.03
mono_points_arrow/encode_log_msg 153685811 ns/iter (± 6409150) 149986089 ns/iter (± 1331538) 1.02
mono_points_arrow/encode_total 334292154 ns/iter (± 11757065) 322521278 ns/iter (± 2050196) 1.04
mono_points_arrow/decode_log_msg 178400834 ns/iter (± 4789593) 173377175 ns/iter (± 1454664) 1.03
mono_points_arrow/decode_message_bundles 63992211 ns/iter (± 3919661) 62144005 ns/iter (± 894102) 1.03
mono_points_arrow/decode_total 240995666 ns/iter (± 8758457) 232724710 ns/iter (± 2056350) 1.04
batch_points_arrow/generate_message_bundles 338427 ns/iter (± 20414) 327705 ns/iter (± 3316) 1.03
batch_points_arrow/generate_messages 6361 ns/iter (± 180) 6175 ns/iter (± 78) 1.03
batch_points_arrow/encode_log_msg 364705 ns/iter (± 12867) 363765 ns/iter (± 3009) 1.00
batch_points_arrow/encode_total 735389 ns/iter (± 31602) 717712 ns/iter (± 8270) 1.02
batch_points_arrow/decode_log_msg 345197 ns/iter (± 11278) 345253 ns/iter (± 2017) 1.00
batch_points_arrow/decode_message_bundles 2047 ns/iter (± 67) 1973 ns/iter (± 20) 1.04
batch_points_arrow/decode_total 350955 ns/iter (± 17963) 352035 ns/iter (± 1959) 1.00
arrow_mono_points/insert 6294760119 ns/iter (± 90811310) 6067780686 ns/iter (± 14410389) 1.04
arrow_mono_points/query 1706945 ns/iter (± 62477) 1681382 ns/iter (± 18399) 1.02
arrow_batch_points/insert 2675754 ns/iter (± 101231) 2604149 ns/iter (± 23576) 1.03
arrow_batch_points/query 16975 ns/iter (± 555) 16516 ns/iter (± 227) 1.03
tuid/Tuid::random 35 ns/iter (± 1) 34 ns/iter (± 0) 1.03

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

Please sign in to comment.