Skip to main content

Module diff

Module diff 

Source
Expand description

Profile diff generation and threshold checking.

This module compares two Profile JSONs (baseline vs target) and produces delta reports with threshold violation detection.

§Example

use stylus_trace_core::diff::{generate_diff, load_thresholds};
use stylus_trace_core::output::json::read_profile;

let baseline = read_profile("baseline.json")?;
let target = read_profile("target.json")?;
let diff = generate_diff(&baseline, &target)?;

let thresholds = load_thresholds("thresholds.toml")?;
let violations = check_thresholds(&diff, &thresholds);

Re-exports§

pub use crate::utils::error::DiffError;

Structs§

Deltas
All calculated deltas
DiffReport
Complete diff report comparing baseline and target profiles
DiffSummary
Summary of diff results
GasDelta
Gas usage delta
GasThresholds
Gas-related thresholds
HostIOThresholds
HostIO-related thresholds
HostIOTypeChange
Change in a specific HostIO type
HostIoDelta
HostIO statistics delta
HotPathComparison
Comparison of a single hot path present in both profiles
HotPathThresholds
Hot path thresholds
HotPathsDelta
Hot paths comparison
ProfileMetadata
Metadata extracted from a profile for comparison
ThresholdConfig
Complete threshold configuration
ThresholdViolation
A single threshold violation

Functions§

analyze_profile
Analyze a profile for qualitative insights
calculate_gas_delta
Calculate gas delta between two profiles
calculate_hostio_type_changes
Calculate changes for each HostIO type
check_gas_thresholds
Check gas thresholds
check_thresholds
Check a diff report against thresholds and update violations
create_summary
Create summary based on violations
generate_diff
Generate a complete diff report comparing two profiles
load_thresholds
Load thresholds from a TOML file
render_terminal_diff
Render a human-readable summary of a diff report for the terminal
safe_percentage
Calculate percentage change safely (handles division by zero)