-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
end-to-end arrow-based scalars / time-series (#666)
* add scalar component * add scalarplotprops component * re_query: visit4 & visit5 * building the scene * dispatching to plot view * complete rust example * python bindings * doesnt look like it's used but still
- Loading branch information
Showing
15 changed files
with
605 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
use arrow2_convert::{ | ||
arrow_enable_vec_for_type, deserialize::ArrowDeserialize, field::ArrowField, | ||
serialize::ArrowSerialize, | ||
}; | ||
|
||
use crate::msg_bundle::Component; | ||
|
||
// --- | ||
|
||
/// A double-precision scalar. | ||
/// | ||
/// ``` | ||
/// use re_log_types::field_types::Scalar; | ||
/// use arrow2_convert::field::ArrowField; | ||
/// use arrow2::datatypes::{DataType, Field}; | ||
/// | ||
/// assert_eq!(Scalar::data_type(), DataType::Float64); | ||
/// ``` | ||
#[derive(Debug, Clone, Copy, derive_more::From, derive_more::Into)] | ||
pub struct Scalar(pub f64); | ||
|
||
arrow_enable_vec_for_type!(Scalar); | ||
|
||
impl ArrowField for Scalar { | ||
type Type = Self; | ||
fn data_type() -> arrow2::datatypes::DataType { | ||
<f64 as ArrowField>::data_type() | ||
} | ||
} | ||
|
||
impl ArrowSerialize for Scalar { | ||
type MutableArrayType = <f64 as ArrowSerialize>::MutableArrayType; | ||
|
||
#[inline] | ||
fn new_array() -> Self::MutableArrayType { | ||
<f64 as ArrowSerialize>::new_array() | ||
} | ||
|
||
#[inline] | ||
fn arrow_serialize(v: &Self, array: &mut Self::MutableArrayType) -> arrow2::error::Result<()> { | ||
<f64 as ArrowSerialize>::arrow_serialize(&v.0, array) | ||
} | ||
} | ||
|
||
impl ArrowDeserialize for Scalar { | ||
type ArrayType = <f64 as ArrowDeserialize>::ArrayType; | ||
|
||
#[inline] | ||
fn arrow_deserialize( | ||
v: <&Self::ArrayType as IntoIterator>::Item, | ||
) -> Option<<Self as ArrowField>::Type> { | ||
<f64 as ArrowDeserialize>::arrow_deserialize(v).map(Scalar) | ||
} | ||
} | ||
|
||
impl Component for Scalar { | ||
fn name() -> crate::ComponentName { | ||
"rerun.scalar".into() | ||
} | ||
} | ||
|
||
// --- | ||
|
||
/// Additional properties of a scalar when rendered as a plot. | ||
/// | ||
/// ``` | ||
/// use re_log_types::field_types::ScalarPlotProps; | ||
/// use arrow2_convert::field::ArrowField; | ||
/// use arrow2::datatypes::{DataType, Field}; | ||
/// | ||
/// assert_eq!( | ||
/// ScalarPlotProps::data_type(), | ||
/// DataType::Struct(vec![ | ||
/// Field::new("scattered", DataType::Boolean, false), | ||
/// ]) | ||
/// ); | ||
/// ``` | ||
#[derive(Debug, Clone, Copy, arrow2_convert::ArrowField)] | ||
pub struct ScalarPlotProps { | ||
pub scattered: bool, | ||
} | ||
|
||
impl Component for ScalarPlotProps { | ||
fn name() -> crate::ComponentName { | ||
"rerun.scalar_plot_props".into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
034f103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust Benchmark
datastore/insert/batch/rects/insert
281468
ns/iter (± 2667
)275899
ns/iter (± 3696
)1.02
datastore/latest_at/batch/rects/query
712
ns/iter (± 2
)722
ns/iter (± 1
)0.99
datastore/latest_at/missing_components/primary
306
ns/iter (± 0
)305
ns/iter (± 0
)1.00
datastore/latest_at/missing_components/secondaries
372
ns/iter (± 0
)372
ns/iter (± 0
)1
datastore/range/batch/rects/query
45102
ns/iter (± 33
)45278
ns/iter (± 68
)1.00
obj_mono_points/insert
1241247556
ns/iter (± 15165627
)941043825
ns/iter (± 6919329
)1.32
obj_mono_points/query
375319
ns/iter (± 7144
)372120
ns/iter (± 3787
)1.01
obj_batch_points/insert
116090396
ns/iter (± 731483
)95493615
ns/iter (± 531217
)1.22
obj_batch_points/query
11495
ns/iter (± 33
)11478
ns/iter (± 22
)1.00
obj_batch_points_sequential/insert
26422364
ns/iter (± 306849
)23881484
ns/iter (± 30674
)1.11
obj_batch_points_sequential/query
7972
ns/iter (± 11
)7956
ns/iter (± 22
)1.00
mono_points_classic/generate_messages
6664583
ns/iter (± 1166702
)4968611
ns/iter (± 278247
)1.34
mono_points_classic/encode_log_msg
17089648
ns/iter (± 576862
)13838820
ns/iter (± 385900
)1.23
mono_points_classic/encode_total
22787506
ns/iter (± 2643036
)20554480
ns/iter (± 922108
)1.11
mono_points_classic/decode_total
43060939
ns/iter (± 1065491
)40139140
ns/iter (± 272661
)1.07
mono_points_arrow/generate_message_bundles
66739347
ns/iter (± 1081415
)53763709
ns/iter (± 623381
)1.24
mono_points_arrow/generate_messages
174560698
ns/iter (± 1886650
)138735682
ns/iter (± 1345995
)1.26
mono_points_arrow/encode_log_msg
207816459
ns/iter (± 6067174
)169444469
ns/iter (± 916652
)1.23
mono_points_arrow/encode_total
449207605
ns/iter (± 5154956
)363533270
ns/iter (± 2011150
)1.24
mono_points_arrow/decode_log_msg
221086532
ns/iter (± 1644215
)190675666
ns/iter (± 927609
)1.16
mono_points_arrow/decode_message_bundles
114545412
ns/iter (± 1612205
)79889872
ns/iter (± 1072545
)1.43
mono_points_arrow/decode_total
325496189
ns/iter (± 2707486
)267454225
ns/iter (± 1945184
)1.22
batch_points_classic/generate_messages
3446
ns/iter (± 136
)3380
ns/iter (± 47
)1.02
batch_points_classic/encode_log_msg
389407
ns/iter (± 3235
)386571
ns/iter (± 568
)1.01
batch_points_classic/encode_total
395509
ns/iter (± 10526
)391285
ns/iter (± 733
)1.01
batch_points_classic/decode_total
748744
ns/iter (± 7392
)742352
ns/iter (± 3231
)1.01
batch_points_arrow/generate_message_bundles
333959
ns/iter (± 1130
)325110
ns/iter (± 578
)1.03
batch_points_arrow/generate_messages
6230
ns/iter (± 17
)6308
ns/iter (± 16
)0.99
batch_points_arrow/encode_log_msg
372267
ns/iter (± 6602
)352650
ns/iter (± 1469
)1.06
batch_points_arrow/encode_total
749704
ns/iter (± 17782
)717522
ns/iter (± 3683
)1.04
batch_points_arrow/decode_log_msg
364502
ns/iter (± 5529
)346710
ns/iter (± 1303
)1.05
batch_points_arrow/decode_message_bundles
2116
ns/iter (± 6
)2128
ns/iter (± 5
)0.99
batch_points_arrow/decode_total
364375
ns/iter (± 11180
)357838
ns/iter (± 1430
)1.02
arrow_mono_points/insert
9976262179
ns/iter (± 111747850
)6863558650
ns/iter (± 38423548
)1.45
arrow_mono_points/query
1740537
ns/iter (± 151648
)1690461
ns/iter (± 25183
)1.03
arrow_batch_points/insert
2719421
ns/iter (± 63068
)2692122
ns/iter (± 34525
)1.01
arrow_batch_points/query
12919
ns/iter (± 14
)13016
ns/iter (± 29
)0.99
obj_batch_points_sequential/Tuid::random
38
ns/iter (± 0
)37
ns/iter (± 0
)1.03
This comment was automatically generated by workflow using github-action-benchmark.