Skip to content

Commit

Permalink
Drop big Vec in a background thread
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Aug 27, 2023
1 parent c4f9eae commit 23c1d02
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/re_space_view_spatial/src/parts/points3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,13 @@ impl Points3DPart {

load_keypoint_connections(ent_context, ent_path, &keypoints);

{
// Suprisingly expensive 😬
re_tracing::profile_scope!("drop(annotation_infos)");
std::mem::drop(annotation_infos);
#[cfg(not(target_arch = "wasm32"))]
if annotation_infos.len() > 1000 {
// Dropping this is surprisingly expensive, so do it in a background thread:
rayon::spawn(move || {
re_tracing::profile_scope!("drop(annotation_infos)");
std::mem::drop(annotation_infos);
});
}

Ok(())
Expand Down

0 comments on commit 23c1d02

Please sign in to comment.