diff --git a/crates/re_tuid/Cargo.toml b/crates/re_tuid/Cargo.toml index 51053749c0a0..0b423be02549 100644 --- a/crates/re_tuid/Cargo.toml +++ b/crates/re_tuid/Cargo.toml @@ -20,21 +20,22 @@ all-features = true default = [] ## Enable (de)serialization using Arrow. -arrow = ["dep:arrow2", "dep:thiserror"] +arrow = ["dep:re_types", "dep:arrow2", "dep:thiserror"] ## Enable (de)serialization using serde. serde = ["dep:serde"] [dependencies] -re_types.workspace = true # TODO - document-features.workspace = true getrandom = "0.2" once_cell.workspace = true web-time.workspace = true -# Optional dependencies: +# Optional dependencies + +re_types = { workspace = true, optional = true } + arrow2 = { workspace = true, optional = true } serde = { version = "1", features = ["derive"], optional = true } thiserror = { workspace = true, optional = true } diff --git a/crates/re_tuid/benches/bench_tuid.rs b/crates/re_tuid/benches/bench_tuid.rs index 4dbd739457d9..86c2566ebe2d 100644 --- a/crates/re_tuid/benches/bench_tuid.rs +++ b/crates/re_tuid/benches/bench_tuid.rs @@ -13,12 +13,12 @@ fn bench_arrow(c: &mut Criterion) { use arrow2::array::Array; use re_types::Loggable as _; - for nb_elems in [1, 1000] { + for elem_count in [1, 1000] { { - let mut group = c.benchmark_group(format!("arrow/serialize/nb_elems={nb_elems}")); - group.throughput(criterion::Throughput::Elements(nb_elems)); + let mut group = c.benchmark_group(format!("arrow/serialize/elem_count={elem_count}")); + group.throughput(criterion::Throughput::Elements(elem_count)); - let tuids = vec![re_tuid::Tuid::random(); nb_elems as usize]; + let tuids = vec![re_tuid::Tuid::random(); elem_count as usize]; group.bench_function("arrow2", |b| { b.iter(|| { @@ -29,11 +29,12 @@ fn bench_arrow(c: &mut Criterion) { } { - let mut group = c.benchmark_group(format!("arrow/deserialize/nb_elems={nb_elems}")); - group.throughput(criterion::Throughput::Elements(nb_elems)); + let mut group = c.benchmark_group(format!("arrow/deserialize/elem_count={elem_count}")); + group.throughput(criterion::Throughput::Elements(elem_count)); let data: Box = - re_tuid::Tuid::to_arrow(vec![re_tuid::Tuid::random(); nb_elems as usize]).unwrap(); + re_tuid::Tuid::to_arrow(vec![re_tuid::Tuid::random(); elem_count as usize]) + .unwrap(); group.bench_function("arrow2", |b| { b.iter(|| { diff --git a/crates/re_tuid/src/arrow.rs b/crates/re_tuid/src/arrow.rs index 1eb7b05ac649..6137965e4437 100644 --- a/crates/re_tuid/src/arrow.rs +++ b/crates/re_tuid/src/arrow.rs @@ -91,7 +91,7 @@ impl Loggable for Tuid { let array = array.as_any().downcast_ref::().unwrap(); // TODO(cmc): Can we rely on the fields ordering from the datatype? I would assume not - // since we generally cannot rely on anything when it comes to arrow... + // since we generally cannot rely on anything when it comes to arrow… // If we could, that would also impact our codegen deserialization path. let (time_ns_index, inc_index) = { let mut time_ns_index = None;