Skip to main content

process_geometry

Function process_geometry 

Source
pub fn process_geometry<T>(content: &T) -> ProcessingResult
where T: AsRef<[u8]> + ?Sized,
Expand description

Process IFC content with parallel geometry extraction (default opening filter).

Examples found in repository?
examples/perf_probe.rs (line 132)
100fn run(path: &str, iters: usize, want_census: bool) -> Option<Probe> {
101    let content = match std::fs::read(path) {
102        Ok(c) => c,
103        Err(e) => {
104            eprintln!("skip {path}: {e}");
105            return None;
106        }
107    };
108    let file_mb = content.len() as f64 / 1.048_576e6;
109
110    // Isolated scan: build_entity_index alone times the pure structural scan
111    // that the pipeline otherwise folds into entity_scan_ms. Best-of-3.
112    let mut index_build_ms = f64::INFINITY;
113    let mut entities = 0usize;
114    for _ in 0..3 {
115        let t = Instant::now();
116        let idx = build_entity_index(&content);
117        let ms = t.elapsed().as_secs_f64() * 1e3;
118        entities = idx.len();
119        index_build_ms = index_build_ms.min(ms);
120    }
121
122    // Full pipeline, best-of-N by total_time_ms. Census (if requested) is
123    // drained from the run that was kept, so the op counts match the timing.
124    let mut best: Option<ProcessingStats> = None;
125    let mut best_total = u64::MAX;
126    let mut best_census: Option<CensusSummary> = None;
127    let mut all_totals_ms = Vec::with_capacity(iters);
128    for _ in 0..iters.max(1) {
129        if want_census {
130            reset_csg_census();
131        }
132        let result = process_geometry(&content);
133        let census = if want_census {
134            Some(summarize_census())
135        } else {
136            None
137        };
138        all_totals_ms.push(result.stats.total_time_ms);
139        if result.stats.total_time_ms <= best_total {
140            best_total = result.stats.total_time_ms;
141            best = Some(result.stats);
142            best_census = census;
143        }
144    }
145
146    Some(Probe {
147        path: path.to_string(),
148        file_mb,
149        entities,
150        index_build_ms,
151        stats: best?,
152        all_totals_ms,
153        census: best_census,
154    })
155}