@@ -563,27 +563,10 @@ pub fn build_density_graph<'a>(
563563 } ;
564564
565565 if should_render_individual_events {
566- // Render all individual events
567566 for ( time, num_events) in chunk. num_events_cumulative_per_unique_time ( timeline) {
568- data. add_chunk_point ( time, num_events as f32 ) ;
569- }
570- } else if config. max_sampled_events_per_chunk > 0 {
571- let events = chunk. num_events_cumulative_per_unique_time ( timeline) ;
572-
573- if events. len ( ) > config. max_sampled_events_per_chunk {
574- // If there's more rows than the configured max, we sample events to get a fast, good enough density estimate.
575- data. add_uniform_sample_from_chunk (
576- & events,
577- config. max_sampled_events_per_chunk ,
578- ) ;
579- } else {
580- // No need to sample, we can use all events.
581- for ( time, num_events) in events {
582- data. add_chunk_point ( time, num_events as f32 ) ;
583- }
567+ data. add_chunk_point ( time, num_events as usize ) ;
584568 }
585569 } else {
586- // Fall back to uniform distribution across the entire time range
587570 data. add_chunk_range ( time_range, num_events_in_chunk) ;
588571 }
589572 }
@@ -602,10 +585,6 @@ pub struct DensityGraphBuilderConfig {
602585
603586 /// If an unsorted chunk has fewer events than this we show its individual events.
604587 pub max_events_in_unsorted_chunk : u64 ,
605-
606- /// When a chunk is too large to render all events, uniformly sample this many events
607- /// to create a good enough density estimate instead.
608- pub max_sampled_events_per_chunk : usize ,
609588}
610589
611590impl DensityGraphBuilderConfig {
@@ -614,7 +593,6 @@ impl DensityGraphBuilderConfig {
614593 max_total_chunk_events : 0 ,
615594 max_events_in_unsorted_chunk : 0 ,
616595 max_events_in_sorted_chunk : 0 ,
617- max_sampled_events_per_chunk : 0 ,
618596 } ;
619597
620598 /// All sorted chunks will be rendered as individual events,
@@ -623,15 +601,13 @@ impl DensityGraphBuilderConfig {
623601 max_total_chunk_events : u64:: MAX ,
624602 max_events_in_unsorted_chunk : 0 ,
625603 max_events_in_sorted_chunk : u64:: MAX ,
626- max_sampled_events_per_chunk : 0 ,
627604 } ;
628605
629606 /// All chunks will be rendered as individual events.
630607 pub const ALWAYS_SPLIT_ALL_CHUNKS : Self = Self {
631608 max_total_chunk_events : u64:: MAX ,
632609 max_events_in_unsorted_chunk : u64:: MAX ,
633610 max_events_in_sorted_chunk : u64:: MAX ,
634- max_sampled_events_per_chunk : 0 ,
635611 } ;
636612}
637613
@@ -654,10 +630,6 @@ impl Default for DensityGraphBuilderConfig {
654630
655631 // Processing unsorted events is about 20% slower than sorted events.
656632 max_events_in_unsorted_chunk : 8_000 ,
657-
658- // When chunks are too large to render all events, sample this many events uniformly
659- // to create a good enough density estimate.
660- max_sampled_events_per_chunk : 8_000 ,
661633 }
662634 }
663635}
@@ -720,32 +692,12 @@ impl<'a> DensityGraphBuilder<'a> {
720692 }
721693 }
722694
723- /// Uniformly sample events using the given sample size.
724- ///
725- /// Each sampled event's count is reweighted to preserve the total density.
726- fn add_uniform_sample_from_chunk ( & mut self , events : & [ ( TimeInt , u64 ) ] , sample_size : usize ) {
727- re_tracing:: profile_function!( ) ;
728-
729- let step = events. len ( ) as f32 / sample_size as f32 ;
730-
731- for i in 0 ..sample_size {
732- let idx = ( i as f32 * step) as usize ;
733- // This means we might miss the last event if rounding down, but that's acceptable.
734- if let Some ( & ( time, count) ) = events. get ( idx) {
735- // Reweight the count to preserve total density
736- let weighted_count = count as f32 * step;
737-
738- self . add_chunk_point ( time, weighted_count) ;
739- }
740- }
741- }
742-
743- fn add_chunk_point ( & mut self , time : TimeInt , weight : f32 ) {
695+ fn add_chunk_point ( & mut self , time : TimeInt , num_events : usize ) {
744696 let Some ( x) = self . time_ranges_ui . x_from_time_f32 ( time. into ( ) ) else {
745697 return ;
746698 } ;
747699
748- self . density_graph . add_point ( x, weight ) ;
700+ self . density_graph . add_point ( x, num_events as _ ) ;
749701
750702 if let Some ( pointer_pos) = self . pointer_pos
751703 && self . row_rect . y_range ( ) . contains ( pointer_pos. y )
0 commit comments