MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / main

Function main

atomic-core/examples/semantic_codec_lab.rs:463–507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

461 Ok(())
462}
463fn main() -> Result<()> {
464 let source = std::env::args()
465 .nth(1)
466 .context("usage: semantic_codec_lab <change-file-or-directory>")?;
467 let mut paths = vec![];
468 collect(Path::new(&source), &mut paths)?;
469 paths.sort();
470 ensure!(!paths.is_empty(), "no change files");
471 let mut rows = vec![];
472 let mut failures = vec![];
473 for path in paths {
474 match measure(&path).with_context(|| path.display().to_string()) {
475 Ok(row) => {
476 eprintln!(
477 "{}: production semantics={} candidate minimum={}",
478 path.display(),
479 row.baseline_semantic_bytes,
480 row.candidates
481 .iter()
482 .map(|c| c.semantic_bytes)
483 .min()
484 .unwrap_or(0)
485 );
486 rows.push(row);
487 }
488 Err(error) => {
489 eprintln!("{error:#}");
490 failures.push(format!("{error:#}"));
491 }
492 }
493 }
494 println!(
495 "{}",
496 serde_json::to_string_pretty(
497 &serde_json::json!({"experiment":"not a production wire format","zstd_level":3,
498 "comparison":"unsigned frozen schema-2/3/4 ATSC-v1 baseline; all candidate headers counted; projections retain other object bytes; independent column sizes are diagnostic, not additive",
499 "rows":rows,"failures":failures})
500 )?
501 );
502 ensure!(
503 failures.is_empty(),
504 "some inputs failed; results are partial"
505 );
506 Ok(())
507}
508
509#[cfg(test)]
510mod tests {

Callers

nothing calls this directly

Calls 7

sortMethod · 0.80
displayMethod · 0.80
collectFunction · 0.70
measureFunction · 0.70
contextMethod · 0.45
with_contextMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected