Skip to content

Commit ce5d373

Browse files
committed
TimesPerTimeline -> TimeHistogramPerTimeline (#7084)
Replace O(n) TimesPerTimeline with O(log n) TimeHistogramPerTimeline for efficient time navigation. Adds prev_key() method to Int64Histogram and TimelineTimes helper struct to bundle timeline metadata with histograms.
1 parent 9f1d202 commit ce5d373

File tree

91 files changed

+2492
-3670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2492
-3670
lines changed

.cargo/config.toml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ run-wasm = "run --release --package run_wasm --"
1212
# so that we don't run them on cargo publish or on users machines.
1313
IS_IN_RERUN_WORKSPACE = "yes"
1414

15-
# Depending on the pixi environment, we get different `CONDA_PREFIX` values.
16-
# This means that changing the pixi environment (or not using it in the first place) will cause rebuilds.
17-
# To avoid unnecessary rebuilds, we set a fixed value here.
18-
# For details see:
19-
# https://pyo3.rs/main/building-and-distribution.html#configuring-the-python-version
20-
PYO3_PYTHON = "python"
21-
22-
# TODO(rust-lang/stacker#127): Work around until wasm build on mac is resolved
23-
[target.osx-arm64.activation.env]
24-
AR = "llvm-ar"
25-
2615
# `web_sys_unstable_apis` is required to enable the web_sys clipboard API which egui_web uses.
2716
# https://wasm-bindgen.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
2817
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html

.github/workflows/contrib_rerun_py.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
5959
- name: Copy rerun-cli to wheel foldcer
6060
run: |
61-
cp target/release/rerun rerun_py/rerun_sdk/rerun_cli
61+
cp target_pixi/release/rerun rerun_py/rerun_sdk/rerun_cli
6262
6363
- name: Build the wheel
6464
run: |

.github/workflows/reusable_build_and_upload_rerun_c.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
- name: "Upload rerun_c (commit)"
168168
uses: google-github-actions/upload-cloud-storage@v2
169169
with:
170-
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.LIB_NAME }}"
170+
path: "./target_pixi/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.LIB_NAME }}"
171171
destination: "rerun-builds/commit/${{ steps.get-sha.outputs.sha }}/rerun_c/${{ inputs.PLATFORM }}"
172172
parent: false
173173
process_gcloudignore: false
@@ -176,7 +176,7 @@ jobs:
176176
if: ${{ inputs.ADHOC_NAME != '' }}
177177
uses: google-github-actions/upload-cloud-storage@v2
178178
with:
179-
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.LIB_NAME }}"
179+
path: "./target_pixi/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.LIB_NAME }}"
180180
destination: "rerun-builds/adhoc/${{inputs.ADHOC_NAME}}/rerun_c/${{ inputs.PLATFORM }}"
181181
parent: false
182182
process_gcloudignore: false

.github/workflows/reusable_build_and_upload_rerun_cli.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
- name: Compare man page to CLI docs
177177
if: runner.os == 'Linux'
178178
run: |
179-
pixi run ./scripts/ci/check_cli_docs.py --rerun-exe "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
179+
pixi run ./scripts/ci/check_cli_docs.py --rerun-exe "./target_pixi/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
180180
181181
- name: Get sha
182182
id: get-sha
@@ -187,7 +187,7 @@ jobs:
187187
- name: "Upload rerun-cli (commit)"
188188
uses: google-github-actions/upload-cloud-storage@v2
189189
with:
190-
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
190+
path: "./target_pixi/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
191191
destination: "rerun-builds/commit/${{ steps.get-sha.outputs.sha }}/rerun-cli/${{ inputs.PLATFORM }}"
192192
parent: false
193193
process_gcloudignore: false
@@ -196,7 +196,7 @@ jobs:
196196
if: ${{ inputs.ADHOC_NAME != '' }}
197197
uses: google-github-actions/upload-cloud-storage@v2
198198
with:
199-
path: "./target/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
199+
path: "./target_pixi/${{ needs.set-config.outputs.TARGET }}/release/${{ needs.set-config.outputs.BIN_NAME }}"
200200
destination: "rerun-builds/adhoc/${{inputs.ADHOC_NAME}}/rerun-cli/${{ inputs.PLATFORM }}"
201201
parent: false
202202
process_gcloudignore: false

Cargo.lock

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8410,26 +8410,20 @@ dependencies = [
84108410
"base64 0.22.1",
84118411
"directories",
84128412
"ehttp",
8413-
"getrandom 0.3.3",
84148413
"http",
84158414
"indicatif",
8416-
"js-sys",
84178415
"jsonwebtoken",
84188416
"rand 0.9.2",
84198417
"re_log",
84208418
"saturating_cast",
84218419
"serde",
84228420
"serde_json",
8423-
"sha2",
84248421
"thiserror 2.0.17",
84258422
"tiny_http",
84268423
"tokio",
84278424
"tonic",
84288425
"tower",
84298426
"url",
8430-
"uuid",
8431-
"wasm-bindgen",
8432-
"web-sys",
84338427
"webbrowser",
84348428
]
84358429

@@ -9309,7 +9303,6 @@ dependencies = [
93099303
"egui",
93109304
"futures",
93119305
"itertools 0.14.0",
9312-
"js-sys",
93139306
"re_auth",
93149307
"re_component_ui",
93159308
"re_dataframe_ui",
@@ -9323,12 +9316,7 @@ dependencies = [
93239316
"re_uri",
93249317
"re_viewer_context",
93259318
"serde",
9326-
"serde_json",
93279319
"url",
9328-
"uuid",
9329-
"wasm-bindgen",
9330-
"web-sys",
9331-
"webbrowser",
93329320
]
93339321

93349322
[[package]]
@@ -10400,14 +10388,11 @@ version = "0.27.0-alpha.8+dev"
1040010388
dependencies = [
1040110389
"ahash",
1040210390
"arrow",
10403-
"criterion",
1040410391
"egui",
1040510392
"egui_tiles",
1040610393
"itertools 0.14.0",
10407-
"mimalloc",
1040810394
"nohash-hasher",
1040910395
"parking_lot",
10410-
"rand 0.9.2",
1041110396
"re_chunk",
1041210397
"re_chunk_store",
1041310398
"re_entity_db",

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ numpy = "0.25.0"
286286
objc2-app-kit = "0.3.2"
287287
opentelemetry = { version = "0.31.0", features = ["metrics"] }
288288
opentelemetry-appender-tracing = "0.31.0"
289-
opentelemetry-http = "0.31.0"
290289
opentelemetry-otlp = "0.31.0"
291290
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] }
292291
ordered-float = "5.1.0"

crates/store/re_entity_db/src/entity_db.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use re_query::{
2121
};
2222
use re_smart_channel::SmartChannelSource;
2323

24-
use crate::{Error, TimesPerTimeline, ingestion_statistics::IngestionStatistics};
24+
use crate::{Error, ingestion_statistics::IngestionStatistics};
2525

2626
// ----------------------------------------------------------------------------
2727

@@ -86,17 +86,9 @@ pub struct EntityDb {
8686
/// In many places we just store the hashes, so we need a way to translate back.
8787
entity_path_from_hash: IntMap<EntityPathHash, EntityPath>,
8888

89-
/// The global-scope time tracker.
90-
///
91-
/// For each timeline, keeps track of what times exist, recursively across all
92-
/// entities/components.
93-
///
94-
/// Used for time control.
95-
///
96-
/// TODO(#7084): Get rid of [`TimesPerTimeline`] and implement time-stepping with [`crate::TimeHistogram`] instead.
97-
times_per_timeline: TimesPerTimeline,
98-
9989
/// A time histogram of all entities, for every timeline.
90+
///
91+
/// Used for time control and gap detection.
10092
time_histogram_per_timeline: crate::TimeHistogramPerTimeline,
10193

10294
/// A tree-view (split on path components) of the entities.
@@ -146,7 +138,6 @@ impl EntityDb {
146138
last_modified_at: web_time::Instant::now(),
147139
latest_row_id: None,
148140
entity_path_from_hash: Default::default(),
149-
times_per_timeline: Default::default(),
150141
tree: crate::EntityTree::root(),
151142
time_histogram_per_timeline: Default::default(),
152143
storage_engine,
@@ -460,10 +451,6 @@ impl EntityDb {
460451
self.storage_engine().store().timelines()
461452
}
462453

463-
pub fn times_per_timeline(&self) -> &TimesPerTimeline {
464-
&self.times_per_timeline
465-
}
466-
467454
pub fn has_any_data_on_timeline(&self, timeline: &TimelineName) -> bool {
468455
self.time_histogram_per_timeline
469456
.get(timeline)
@@ -483,6 +470,11 @@ impl EntityDb {
483470
self.time_histogram_per_timeline.get(timeline)
484471
}
485472

473+
/// Histogram of all entities and events
474+
pub fn time_histogram_per_timeline(&self) -> &crate::TimeHistogramPerTimeline {
475+
&self.time_histogram_per_timeline
476+
}
477+
486478
#[inline]
487479
pub fn num_rows(&self) -> u64 {
488480
self.storage_engine.read().store().stats().total().num_rows
@@ -600,7 +592,6 @@ impl EntityDb {
600592

601593
{
602594
// Update our internal views by notifying them of resulting [`ChunkStoreEvent`]s.
603-
self.times_per_timeline.on_events(&store_events);
604595
self.time_histogram_per_timeline.on_events(&store_events);
605596
self.tree.on_store_additions(&store_events);
606597

@@ -675,7 +666,6 @@ impl EntityDb {
675666
);
676667

677668
Self::on_store_deletions(
678-
&mut self.times_per_timeline,
679669
&mut self.time_histogram_per_timeline,
680670
&mut self.tree,
681671
engine,
@@ -699,7 +689,6 @@ impl EntityDb {
699689

700690
let store_events = engine.store().drop_time_range(timeline, drop_range);
701691
Self::on_store_deletions(
702-
&mut self.times_per_timeline,
703692
&mut self.time_histogram_per_timeline,
704693
&mut self.tree,
705694
engine,
@@ -721,7 +710,6 @@ impl EntityDb {
721710

722711
let store_events = engine.store().drop_entity_path(entity_path);
723712
Self::on_store_deletions(
724-
&mut self.times_per_timeline,
725713
&mut self.time_histogram_per_timeline,
726714
&mut self.tree,
727715
engine,
@@ -749,14 +737,12 @@ impl EntityDb {
749737
// NOTE: Parameters deconstructed instead of taking `self`, because borrowck cannot understand
750738
// partial borrows on methods.
751739
fn on_store_deletions(
752-
times_per_timeline: &mut TimesPerTimeline,
753740
time_histogram_per_timeline: &mut crate::TimeHistogramPerTimeline,
754741
tree: &mut crate::EntityTree,
755742
mut engine: StorageEngineWriteGuard<'_>,
756743
store_events: &[ChunkStoreEvent],
757744
) {
758745
engine.cache().on_events(store_events);
759-
times_per_timeline.on_events(store_events);
760746
time_histogram_per_timeline.on_events(store_events);
761747

762748
let engine = engine.downgrade();

crates/store/re_entity_db/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ mod ingestion_statistics;
1010
mod instance_path;
1111
mod store_bundle;
1212
mod time_histogram_per_timeline;
13-
mod times_per_timeline;
1413
mod versioned_instance_path;
1514

1615
pub use self::{
@@ -20,7 +19,6 @@ pub use self::{
2019
instance_path::{InstancePath, InstancePathHash},
2120
store_bundle::{StoreBundle, StoreLoadError},
2221
time_histogram_per_timeline::{TimeHistogram, TimeHistogramPerTimeline},
23-
times_per_timeline::{TimeCounts, TimelineStats, TimesPerTimeline},
2422
versioned_instance_path::{VersionedInstancePath, VersionedInstancePathHash},
2523
};
2624

0 commit comments

Comments
 (0)