Skip to content

Commit

Permalink
lints and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 13, 2023
1 parent d7e2f86 commit f5f01d6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions crates/re_tuid/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
15 changes: 8 additions & 7 deletions crates/re_tuid/benches/bench_tuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|| {
Expand All @@ -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<dyn Array> =
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(|| {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_tuid/src/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Loggable for Tuid {
let array = array.as_any().downcast_ref::<StructArray>().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;
Expand Down

0 comments on commit f5f01d6

Please sign in to comment.