-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test of memory use when logging a lot of big images (#1372)
* Add a test of memory use when logging a lot of big images * copy-pasta Co-authored-by: Clement Rey <[email protected]> * copy-pasta Co-authored-by: Clement Rey <[email protected]> * Add store archiving to the stack shortening * fix feature name --------- Co-authored-by: Clement Rey <[email protected]>
- Loading branch information
Showing
16 changed files
with
105 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["crates/*", "examples/rust/*", "rerun_py", "run_wasm"] | ||
members = [ | ||
"crates/*", | ||
"examples/rust/*", | ||
"rerun_py", | ||
"run_wasm", | ||
"tests/rust/*", | ||
] | ||
|
||
[workspace.package] | ||
authors = ["rerun.io <[email protected]>"] | ||
|
@@ -55,6 +61,7 @@ half = "2.0" | |
image = "0.24" | ||
lazy_static = "1.4" | ||
macaw = "0.18" | ||
mimalloc = "0.1.29" | ||
ndarray = "0.15" | ||
polars-core = "0.27.1" | ||
polars-lazy = "0.27.1" | ||
|
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
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 @@ | ||
Uses of the rerun SDK designed to test different things. |
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,13 @@ | ||
[package] | ||
name = "test_image_memory" | ||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
license.workspace = true | ||
publish = false | ||
|
||
[dependencies] | ||
rerun.workspace = true | ||
re_format.workspace = true | ||
|
||
mimalloc.workspace = true |
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,56 @@ | ||
//! Logs a bunch of big images to test Rerun memory usage. | ||
|
||
use mimalloc::MiMalloc; | ||
use re_memory::AccountingAllocator; | ||
use rerun::external::{image, re_memory, re_viewer}; | ||
|
||
#[global_allocator] | ||
static GLOBAL: AccountingAllocator<MiMalloc> = AccountingAllocator::new(MiMalloc); | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
re_memory::accounting_allocator::turn_on_tracking_if_env_var( | ||
re_viewer::env_vars::RERUN_TRACK_ALLOCATIONS, | ||
); | ||
|
||
let session = rerun::Session::init("test_image_memory_rs", true); | ||
|
||
session.spawn(|mut session| { | ||
log_images(&mut session).unwrap(); | ||
})?; | ||
|
||
Ok(()) | ||
} | ||
|
||
fn log_images(session: &mut rerun::Session) -> Result<(), Box<dyn std::error::Error>> { | ||
let (w, h) = (2048, 1024); | ||
let n = 100; | ||
|
||
let image = image::RgbaImage::from_fn(w, h, |x, y| { | ||
if (x + y) % 2 == 0 { | ||
image::Rgba([0, 0, 0, 255]) | ||
} else { | ||
image::Rgba([255, 255, 255, 255]) | ||
} | ||
}); | ||
let tensor = rerun::components::Tensor::from_image(image)?; | ||
|
||
for _ in 0..n { | ||
rerun::MsgSender::new("image") | ||
.with_component(&[tensor.clone()])? | ||
.send(session)?; | ||
} | ||
|
||
eprintln!( | ||
"Logged {n} {w}x{h} RGBA images = {}", | ||
re_format::format_bytes((n * w * h * 4) as _) | ||
); | ||
|
||
// Give viewer time to load it: | ||
std::thread::sleep(std::time::Duration::from_secs(2)); | ||
|
||
if let Some(allocs) = re_memory::accounting_allocator::global_allocs() { | ||
eprintln!("{} RAM used", re_format::format_bytes(allocs.size as _)); | ||
} | ||
|
||
Ok(()) | ||
} |
6b9aab0
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
550921
ns/iter (± 3261
)560773
ns/iter (± 1724
)0.98
datastore/latest_at/batch/rects/query
1827
ns/iter (± 6
)1805
ns/iter (± 28
)1.01
datastore/latest_at/missing_components/primary
356
ns/iter (± 2
)357
ns/iter (± 0
)1.00
datastore/latest_at/missing_components/secondaries
425
ns/iter (± 14
)425
ns/iter (± 0
)1
datastore/range/batch/rects/query
150015
ns/iter (± 510
)150127
ns/iter (± 234
)1.00
mono_points_arrow/generate_message_bundles
47286805
ns/iter (± 983856
)53231303
ns/iter (± 609706
)0.89
mono_points_arrow/generate_messages
125737059
ns/iter (± 1096303
)139356081
ns/iter (± 1459025
)0.90
mono_points_arrow/encode_log_msg
153199409
ns/iter (± 939772
)173224585
ns/iter (± 2468141
)0.88
mono_points_arrow/encode_total
327214877
ns/iter (± 1488287
)369964000
ns/iter (± 3903155
)0.88
mono_points_arrow/decode_log_msg
176399062
ns/iter (± 777294
)190135352
ns/iter (± 1428624
)0.93
mono_points_arrow/decode_message_bundles
64556734
ns/iter (± 766064
)77249933
ns/iter (± 1168466
)0.84
mono_points_arrow/decode_total
238830646
ns/iter (± 1386896
)269983640
ns/iter (± 2093104
)0.88
batch_points_arrow/generate_message_bundles
323961
ns/iter (± 2533
)324793
ns/iter (± 879
)1.00
batch_points_arrow/generate_messages
6346
ns/iter (± 39
)6404
ns/iter (± 14
)0.99
batch_points_arrow/encode_log_msg
365663
ns/iter (± 2095
)373777
ns/iter (± 3057
)0.98
batch_points_arrow/encode_total
713250
ns/iter (± 4746
)726038
ns/iter (± 2838
)0.98
batch_points_arrow/decode_log_msg
348663
ns/iter (± 1182
)349642
ns/iter (± 1427
)1.00
batch_points_arrow/decode_message_bundles
2080
ns/iter (± 14
)2128
ns/iter (± 5
)0.98
batch_points_arrow/decode_total
355260
ns/iter (± 1495
)361712
ns/iter (± 2120
)0.98
arrow_mono_points/insert
6107628644
ns/iter (± 12499650
)7471020932
ns/iter (± 177013735
)0.82
arrow_mono_points/query
1726227
ns/iter (± 14526
)1780967
ns/iter (± 14889
)0.97
arrow_batch_points/insert
2691302
ns/iter (± 18310
)2713162
ns/iter (± 31137
)0.99
arrow_batch_points/query
16806
ns/iter (± 109
)16846
ns/iter (± 36
)1.00
tuid/Tuid::random
34
ns/iter (± 0
)34
ns/iter (± 0
)1
This comment was automatically generated by workflow using github-action-benchmark.