moonbench

    A lightweight stopwatch, benchmark reporting, and baseline comparison toolkit for MoonBit projects.

    benchmark
    stopwatch
    report
    performance
    Download zip
    Version
    0.3.0
    License
    MIT
    Last updated
    last month
    Downloads
    19

    #MoonBench

    MoonBench 是一个面向 MoonBit 项目的轻量级基准测试与性能报告工具包。它提供可复用的计时、采样统计、多项 benchmark 汇总、Markdown/JSON/CSV 报告输出,以及与历史基线进行对比的能力。

    这个包的设计目标是帮助 MoonBit 开发者把性能数据变成稳定、可读、可自动化处理的工程产物:可以放进 README,可以作为 CI artifact,也可以用于版本发布时说明某个优化是否真的带来了收益。

    #安装

    moon add Han-Wentao/moonbench

    包页面:

    https://mooncakes.io/docs/Han-Wentao/moonbench

    #适用场景

    • 为 MoonBit 库或应用编写小型 micro-benchmark。
    • 在 CI 中生成 Markdown、JSON 或 CSV 性能报告。
    • 在 PR 或版本发布中比较当前性能与历史基线。
    • 对多项 benchmark 做统一汇总,快速看到最快、最慢和总体趋势。
    • 在测试中使用纯状态 Stopwatch 验证计时逻辑。

    #核心类型

    MoonBench 0.3.0 已从单项 benchmark 工具扩展为完整报告工具链,核心能力包括:

    • SampleStatsStopwatchBenchmarkRunner:基础采样和计时。
    • BenchmarkSuiteReportMetadata:多 benchmark 汇总报告。
    • BaselineSetBaselineParseReportComparisonReport:可持久化历史基线、解析诊断与性能对比。
    • SampleSeriesTrendAnalysis:趋势、波动、移动平均和噪声分析。
    • ThresholdPolicyGateReport:CI 性能质量门禁。
    • BenchmarkSnapshotSnapshotDiffReport:版本快照与回归分析。
    • ScenarioCatalogWorkloadScenario:标准 benchmark 场景目录。
    • ArtifactBundleSubmissionChecklistProjectScorecard:比赛提交和自检辅助。
    • ApiCatalogDocTemplateSet:公开 API 目录和文档模板。

    #SampleStats

    SampleStats 从微秒采样数组中计算基础统计量:

    • count
    • min_us
    • max_us
    • mean_us
    • median_us
    • stddev_us

    示例:

    let stats = @moonbench.SampleStats::from_samples([10.0, 4.0, 8.0, 6.0])
    println(stats.mean_us)
    println(stats.median_us)

    #Stopwatch

    Stopwatch 是纯状态秒表,不直接依赖系统时间,因此很适合测试:

    let watch = @moonbench.Stopwatch::new().start(100).stop(160).start(200)
    println(watch.elapsed(250))

    支持能力:

    • new
    • start
    • stop
    • reset
    • elapsed
    • lap

    #BenchmarkRunner

    BenchmarkRunner 负责 warmup 和多次迭代采样。

    手动提供测量值:

    let result = @moonbench.BenchmarkRunner::new(warmup=0, iterations=3).run(
    "manual-sample",
    () => 42.0,
    )
    println(result.to_markdown())

    直接计时代码块:

    let mut value = 0
    let result = @moonbench.BenchmarkRunner::new(warmup=1, iterations=4).run_timed(
    "increment",
    () => {
    value = value + 1
    ignore(value)
    },
    )
    println(result.to_json_with_samples())

    #BenchmarkSuite

    BenchmarkSuite 用于汇总多个 benchmark,并生成统一报告:

    let runner = @moonbench.BenchmarkRunner::new(warmup=1, iterations=4)
    let mut current = 0
    let increment = runner.run_timed("increment-example", () => {
    current = current + 1
    ignore(current)
    })
    let arithmetic = runner.run("manual-sample-example", () => 42.0)

    let suite = @moonbench.BenchmarkSuite::new(
    title="Basic MoonBench example",
    package_name="Han-Wentao/moonbench",
    package_version="0.3.0",
    target="wasm-gc",
    ).add(increment).add(arithmetic)

    println(suite.to_markdown())
    println(suite.to_csv())
    println(suite.to_json())

    汇总指标包括:

    • benchmark 数量
    • 总迭代次数
    • 平均 mean_us
    • fastest benchmark 名称
    • slowest benchmark 名称

    #BaselineSet 和 ComparisonReport

    BaselineSet 用于保存历史基线,ComparisonReport 用于输出对比结果:

    let report = @moonbench.BaselineSet::new()
    .add("increment-example", increment.stats.mean_us)
    .add("manual-sample-example", 40.0)
    .compare_suite(suite, tolerance_pct=5.0)

    println(report.to_markdown())
    println(report.to_json())

    基线也可以使用 name=mean_us 文本保存到仓库,在本地和 CI 中共享:

    let parsed = @moonbench.BaselineSet::parse_text(
    "# moonbench.baseline\nparse=12.5\nrender=40.0\n",
    )
    if parsed.is_valid() {
    println(parsed.baselines.compare_suite(suite).to_markdown())
    } else {
    println(parsed.issues_to_markdown())
    }

    解析器会忽略空行和注释、清理两侧空格,并对格式错误、负数、NaN、无穷大返回带行号的诊断。同名条目采用最后一个有效值。

    状态说明:

    • faster:当前结果比基线更快,且超过阈值。
    • stable:当前结果仍在阈值范围内。
    • slower:当前结果比基线更慢,且超过阈值。
    • missing_baseline:没有找到同名基线。

    #ReportMetadata

    报告元信息可以帮助 CI 或评审材料说明报告来源:

    let metadata = @moonbench.ReportMetadata::new(
    title="MoonBench CI Report",
    package_name="Han-Wentao/moonbench",
    package_version="0.3.0",
    target="wasm-gc",
    note="Generated in CI",
    )
    println(metadata.to_markdown())

    #名称校验

    MoonBench 提供简单的名称校验与规范化工具,避免报告输出被空名称、多行名称或 Markdown 分隔符污染:

    let issue = @moonbench.validate_benchmark_name("case-1")
    println(issue.ok)
    println(@moonbench.normalize_benchmark_name("a|b\nc"))

    #输出格式

    MoonBench 支持三类常见输出:

    • Markdown:适合 README、PR 评论、GitHub Summary 和比赛文档。
    • JSON:适合机器读取、后续分析或作为 CI artifact。
    • CSV:适合表格软件、脚本处理或横向比较。

    单项结果可以使用:

    result.to_markdown()
    result.to_json()
    result.to_json_with_samples()
    result.to_csv_row()

    多项结果可以使用:

    suite.to_markdown()
    suite.to_json()
    suite.to_csv()

    基线对比可以使用:

    comparison_report.to_markdown()
    comparison_report.to_json()

    #本仓库验证命令

    moon check moon test moon run cmd/main moon run examples/basic moon package

    当前仓库自检结果:

    • MoonBit 源码、测试和示例:6415 行。
    • 测试数量:59 个。
    • demo 输出:suite 报告、baseline comparison、quality gate、scenario catalog、scorecard、reviewer summary、CSV、JSON。

    #设计取舍

    MoonBench 不是为了替代大型专业 benchmark 框架,而是优先服务 MoonBit 生态中最常见的轻量级需求:

    • API 足够小,学习成本低。
    • 输出格式稳定,适合自动化。
    • 不强绑定外部服务,易于在本地和 CI 中运行。
    • 测试覆盖核心边界,便于后续维护。
    • 与 mooncakes.io 发布流程兼容,便于生态复用。

    #参赛说明

    MoonBench 是 MoonBit 原生实现,围绕工程基础设施场景提供可复用能力。项目包含可运行示例、自动化测试、CI、MIT License、中文说明文档和 mooncakes.io 发布版本。它可以作为 MoonBit 项目性能评估的基础组件,也可以作为后续更完整 benchmark 工具链的起点。

    #License

    MIT

    ApiCatalog

    pub(all) struct ApiCatalog {
    title : String
    symbols : Array[ApiSymbol]
    } derive(Eq,
    Debug
    )

    A searchable public API catalog.

    ApiCatalog::add

    fn ApiCatalog::add(self : ApiCatalog, symbol : ApiSymbol) -> ApiCatalog

    Append one API symbol.

    ApiCatalog::contains

    fn ApiCatalog::contains(self : ApiCatalog, name : String) -> Bool

    Whether a symbol exists.

    ApiCatalog::count

    fn ApiCatalog::count(self : ApiCatalog) -> Int

    Number of symbols.

    ApiCatalog::count_kind

    fn ApiCatalog::count_kind(self : ApiCatalog, kind : String) -> Int

    Count symbols by kind.

    ApiCatalog::filter_kind

    fn ApiCatalog::filter_kind(self : ApiCatalog, kind : String) -> ApiCatalog

    Filter symbols by kind.

    ApiCatalog::filter_since

    fn ApiCatalog::filter_since(self : ApiCatalog, since : String) -> ApiCatalog

    Filter symbols introduced since a version string.

    ApiCatalog::find

    fn ApiCatalog::find(self : ApiCatalog, name : String) -> ApiSymbol

    Find a symbol by name.

    ApiCatalog::moonbench_standard

    fn ApiCatalog::moonbench_standard() -> ApiCatalog

    Standard public API catalog for MoonBench.

    ApiCatalog::new

    fn ApiCatalog::new(title? : String) -> ApiCatalog

    Create an empty API catalog.

    ApiCatalog::stable_count

    fn ApiCatalog::stable_count(self : ApiCatalog) -> Int

    Count stable symbols.

    ApiCatalog::to_json

    fn ApiCatalog::to_json(self : ApiCatalog) -> String

    Render catalog as JSON.

    ApiCatalog::to_markdown

    fn ApiCatalog::to_markdown(self : ApiCatalog) -> String

    Render catalog as Markdown.

    ApiSymbol

    pub(all) struct ApiSymbol {
    name : String
    kind : String
    package_name : String
    summary : String
    since : String
    stable : Bool
    example : String
    } derive(Eq,
    Debug
    )

    Public API symbol metadata for generated documentation.

    ApiSymbol::new

    fn ApiSymbol::new(name : String, kind : String, package_name? : String, summary? : String, since? : String, stable? : Bool, example? : String) -> ApiSymbol

    Create API symbol metadata.

    ApiSymbol::to_json

    fn ApiSymbol::to_json(self : ApiSymbol) -> String

    Render API symbol as JSON.

    ApiSymbol::to_markdown_row

    fn ApiSymbol::to_markdown_row(self : ApiSymbol) -> String

    Render API symbol as Markdown row.

    Artifact

    pub(all) struct Artifact {
    name : String
    kind : String
    path : String
    media_type : String
    description : String
    required : Bool
    } derive(Eq,
    Debug
    )

    A generated artifact that can be attached to CI or contest submission.

    Artifact::csv

    fn Artifact::csv(name : String, path : String, description? : String) -> Artifact

    Create a CSV artifact descriptor.

    Artifact::has_path

    fn Artifact::has_path(self : Artifact) -> Bool

    Whether the artifact has a usable path.

    Artifact::json

    fn Artifact::json(name : String, path : String, description? : String) -> Artifact

    Create a JSON artifact descriptor.

    Artifact::markdown

    fn Artifact::markdown(name : String, path : String, description? : String) -> Artifact

    Create a Markdown artifact descriptor.

    Artifact::new

    fn Artifact::new(name : String, kind? : String, path? : String, media_type? : String, description? : String, required? : Bool) -> Artifact

    Create a generic artifact descriptor.

    Artifact::to_json

    fn Artifact::to_json(self : Artifact) -> String

    Render an artifact as compact JSON.

    Artifact::to_markdown_row

    fn Artifact::to_markdown_row(self : Artifact) -> String

    Render an artifact as one Markdown table row.

    Artifact::zip

    fn Artifact::zip(name : String, path : String, description? : String) -> Artifact

    Create a zip artifact descriptor.

    ArtifactBundle

    pub(all) struct ArtifactBundle {
    title : String
    artifacts : Array[Artifact]
    } derive(Eq,
    Debug
    )

    A bundle of generated or expected artifacts.

    ArtifactBundle::add

    fn ArtifactBundle::add(self : ArtifactBundle, artifact : Artifact) -> ArtifactBundle

    Return a new bundle with one artifact appended.

    ArtifactBundle::count

    fn ArtifactBundle::count(self : ArtifactBundle) -> Int

    Number of artifacts.

    ArtifactBundle::moonbench_standard

    fn ArtifactBundle::moonbench_standard() -> ArtifactBundle

    Standard artifact bundle for MoonBench submission.

    ArtifactBundle::new

    fn ArtifactBundle::new(title? : String) -> ArtifactBundle

    Create an empty artifact bundle.

    ArtifactBundle::required_count

    fn ArtifactBundle::required_count(self : ArtifactBundle) -> Int

    Number of required artifacts.

    ArtifactBundle::required_paths_ready

    fn ArtifactBundle::required_paths_ready(self : ArtifactBundle) -> Bool

    Whether every required artifact has a path.

    ArtifactBundle::to_json

    fn ArtifactBundle::to_json(self : ArtifactBundle) -> String

    Render artifact bundle as compact JSON.

    ArtifactBundle::to_markdown

    fn ArtifactBundle::to_markdown(self : ArtifactBundle) -> String

    Render artifact bundle as Markdown.

    ArtifactBundle::with_path_count

    fn ArtifactBundle::with_path_count(self : ArtifactBundle) -> Int

    Number of artifacts with a path.

    BadgeSet

    pub(all) struct BadgeSet {
    badges : Array[StatusBadge]
    } derive(Eq,
    Debug
    )

    A collection of badges.

    BadgeSet::add

    fn BadgeSet::add(self : BadgeSet, badge : StatusBadge) -> BadgeSet

    Append a badge.

    BadgeSet::count

    fn BadgeSet::count(self : BadgeSet) -> Int

    Number of badges.

    BadgeSet::moonbench_standard

    fn BadgeSet::moonbench_standard() -> BadgeSet

    Standard badges for MoonBench.

    BadgeSet::new

    fn BadgeSet::new() -> BadgeSet

    Create an empty badge set.

    BadgeSet::to_json

    fn BadgeSet::to_json(self : BadgeSet) -> String

    Render badges as JSON.

    BadgeSet::to_markdown

    fn BadgeSet::to_markdown(self : BadgeSet) -> String

    Render all badges as one Markdown line.

    BaselineComparison

    pub(all) struct BaselineComparison {
    name : String
    baseline_mean_us : Double
    current_mean_us : Double
    delta_pct : Double
    status : String
    } derive(Eq,
    Debug
    )

    Comparison between a current benchmark and a baseline mean.

    BaselineComparison::to_markdown

    fn BaselineComparison::to_markdown(self : BaselineComparison) -> String

    Render a baseline comparison as Markdown.

    BaselineEntry

    pub(all) struct BaselineEntry {
    name : String
    mean_us : Double
    } derive(Eq,
    Debug
    )

    A named baseline value measured in microseconds.

    BaselineParseIssue

    pub(all) struct BaselineParseIssue {
    line : Int
    content : String
    message : String
    } derive(Eq,
    Debug
    )

    One diagnostic produced while parsing baseline text.

    BaselineParseReport

    pub(all) struct BaselineParseReport {
    baselines : BaselineSet
    issues : Array[BaselineParseIssue]
    } derive(Eq,
    Debug
    )

    Result of parsing a portable MoonBench baseline document.

    BaselineParseReport::count

    fn BaselineParseReport::count(self : BaselineParseReport) -> Int

    Number of accepted, unique baseline entries.

    BaselineParseReport::is_valid

    fn BaselineParseReport::is_valid(self : BaselineParseReport) -> Bool

    Whether the complete baseline document parsed without diagnostics.

    BaselineParseReport::issue_count

    fn BaselineParseReport::issue_count(self : BaselineParseReport) -> Int

    Number of invalid input lines.

    BaselineParseReport::issues_to_markdown

    fn BaselineParseReport::issues_to_markdown(self : BaselineParseReport) -> String

    Render parser diagnostics as Markdown for CI summaries.

    BaselineSet

    pub(all) struct BaselineSet {
    entries : Array[BaselineEntry]
    } derive(Eq,
    Debug
    )

    A simple baseline database for matching results by benchmark name.

    BaselineSet::add

    fn BaselineSet::add(self : BaselineSet, name : String, mean_us : Double) -> BaselineSet

    Return a new baseline set with one entry appended.

    BaselineSet::compare_suite

    fn BaselineSet::compare_suite(self : BaselineSet, suite : BenchmarkSuite, tolerance_pct? : Double) -> ComparisonReport

    Compare every benchmark in a suite with matching baselines.

    BaselineSet::count

    fn BaselineSet::count(self : BaselineSet) -> Int

    Count entries in the baseline set.

    BaselineSet::new

    Create an empty baseline set.

    BaselineSet::parse_text

    fn BaselineSet::parse_text(text : String) -> BaselineParseReport

    Parse name=mean_us lines into a baseline set.

    Empty lines and lines beginning with # are ignored. Whitespace around names and values is trimmed. Invalid lines are reported and skipped, while duplicate names use the last valid value.

    BaselineSet::set

    fn BaselineSet::set(self : BaselineSet, name : String, mean_us : Double) -> BaselineSet

    Return a new baseline set with name inserted or replaced.

    This is useful when loading baseline files where the last declaration wins.

    BaselineSet::to_text

    fn BaselineSet::to_text(self : BaselineSet) -> String

    Render the baseline set using the portable name=mean_us format.

    BenchmarkResult

    pub(all) struct BenchmarkResult {
    name : String
    warmup : Int
    iterations : Int
    samples_us : Array[Double]
    stats : SampleStats
    } derive(Eq,
    Debug
    )

    A named benchmark result.

    BenchmarkResult::compare_baseline

    fn BenchmarkResult::compare_baseline(self : BenchmarkResult, baseline_mean_us : Double, tolerance_pct? : Double) -> BaselineComparison

    Compare a result with a baseline mean in microseconds.

    BenchmarkResult::to_csv_row

    fn BenchmarkResult::to_csv_row(self : BenchmarkResult) -> String

    Render a result as one CSV row.

    BenchmarkResult::to_json

    fn BenchmarkResult::to_json(self : BenchmarkResult) -> String

    Render a benchmark result as compact JSON.

    BenchmarkResult::to_json_with_samples

    fn BenchmarkResult::to_json_with_samples(self : BenchmarkResult) -> String

    Render a benchmark result as JSON including the raw samples.

    BenchmarkResult::to_markdown

    fn BenchmarkResult::to_markdown(self : BenchmarkResult) -> String

    Render a benchmark result as a Markdown table.

    BenchmarkResult::to_markdown_row

    fn BenchmarkResult::to_markdown_row(self : BenchmarkResult) -> String

    Render one Markdown table row for a benchmark result.

    BenchmarkRunner

    pub(all) struct BenchmarkRunner {
    warmup : Int
    iterations : Int
    } derive(Eq,
    Debug
    )

    Configuration for repeatable benchmark runs.

    BenchmarkRunner::new

    fn BenchmarkRunner::new(warmup? : Int, iterations? : Int) -> BenchmarkRunner

    Create a benchmark runner.

    BenchmarkRunner::run

    fn BenchmarkRunner::run(self : BenchmarkRunner, name : String, measure : () -> Double) -> BenchmarkResult

    Run a measurement function and summarize the returned microsecond samples.

    BenchmarkRunner::run_timed

    fn BenchmarkRunner::run_timed(self : BenchmarkRunner, name : String, body : () -> Unit) -> BenchmarkResult

    Run and time a benchmark body with the monotonic clock.

    BenchmarkSnapshot

    pub(all) struct BenchmarkSnapshot {
    label : String
    commit : String
    target : String
    created_at : String
    metrics : Array[MetricSnapshot]
    } derive(Eq,
    Debug
    )

    A benchmark snapshot captured at a point in time.

    BenchmarkSnapshot::add

    Append one metric snapshot.

    BenchmarkSnapshot::average_mean_us

    fn BenchmarkSnapshot::average_mean_us(self : BenchmarkSnapshot) -> Double

    Average mean across metrics.

    BenchmarkSnapshot::contains

    fn BenchmarkSnapshot::contains(self : BenchmarkSnapshot, name : String) -> Bool

    Whether a metric exists.

    BenchmarkSnapshot::count

    fn BenchmarkSnapshot::count(self : BenchmarkSnapshot) -> Int

    Number of metrics.

    BenchmarkSnapshot::diff

    fn BenchmarkSnapshot::diff(self : BenchmarkSnapshot, after : BenchmarkSnapshot, tolerance_pct? : Double) -> SnapshotDiffReport

    Compare two snapshots.

    BenchmarkSnapshot::find

    fn BenchmarkSnapshot::find(self : BenchmarkSnapshot, name : String) -> MetricSnapshot

    Find a metric by name.

    BenchmarkSnapshot::from_suite

    fn BenchmarkSnapshot::from_suite(suite : BenchmarkSuite, label? : String, commit? : String, target? : String, created_at? : String) -> BenchmarkSnapshot

    Create a snapshot from a benchmark suite.

    BenchmarkSnapshot::new

    fn BenchmarkSnapshot::new(label? : String, commit? : String, target? : String, created_at? : String) -> BenchmarkSnapshot

    Create an empty benchmark snapshot.

    BenchmarkSnapshot::to_baseline_set

    fn BenchmarkSnapshot::to_baseline_set(self : BenchmarkSnapshot) -> BaselineSet

    Convert snapshot to baseline set using mean values.

    BenchmarkSnapshot::to_baseline_text

    fn BenchmarkSnapshot::to_baseline_text(self : BenchmarkSnapshot) -> String

    Render snapshot as a simple baseline text document.

    BenchmarkSnapshot::to_json

    fn BenchmarkSnapshot::to_json(self : BenchmarkSnapshot) -> String

    Render snapshot as JSON.

    BenchmarkSnapshot::to_markdown

    fn BenchmarkSnapshot::to_markdown(self : BenchmarkSnapshot) -> String

    Render snapshot as Markdown.

    BenchmarkSuite

    pub(all) struct BenchmarkSuite {
    metadata : ReportMetadata
    results : Array[BenchmarkResult]
    } derive(Eq,
    Debug
    )

    A collection of benchmark results that can be rendered as one report.

    BenchmarkSuite::add

    Return a new suite with one result appended.

    BenchmarkSuite::append

    Return a new suite with another suite appended.

    BenchmarkSuite::average_mean_us

    fn BenchmarkSuite::average_mean_us(self : BenchmarkSuite) -> Double

    Average the per-result mean values in the suite.

    BenchmarkSuite::count

    fn BenchmarkSuite::count(self : BenchmarkSuite) -> Int

    Count benchmark results in the suite.

    BenchmarkSuite::fastest_name

    fn BenchmarkSuite::fastest_name(self : BenchmarkSuite) -> String

    Name of the result with the lowest mean time.

    BenchmarkSuite::new

    fn BenchmarkSuite::new(title? : String, package_name? : String, package_version? : String, target? : String, note? : String) -> BenchmarkSuite

    Create an empty benchmark suite.

    BenchmarkSuite::slowest_name

    fn BenchmarkSuite::slowest_name(self : BenchmarkSuite) -> String

    Name of the result with the highest mean time.

    BenchmarkSuite::to_csv

    fn BenchmarkSuite::to_csv(self : BenchmarkSuite) -> String

    Render the suite as CSV for spreadsheet or CI artifact consumption.

    BenchmarkSuite::to_json

    fn BenchmarkSuite::to_json(self : BenchmarkSuite) -> String

    Render the suite as compact JSON.

    BenchmarkSuite::to_markdown

    fn BenchmarkSuite::to_markdown(self : BenchmarkSuite) -> String

    Render the suite as Markdown with one combined table.

    BenchmarkSuite::total_iterations

    fn BenchmarkSuite::total_iterations(self : BenchmarkSuite) -> Int

    Count all measured iterations in the suite.

    ChecklistItem

    pub(all) struct ChecklistItem {
    id : String
    title : String
    description : String
    done : Bool
    evidence : String
    required : Bool
    } derive(Eq,
    Debug
    )

    A checklist item for release and contest submission.

    ChecklistItem::complete

    fn ChecklistItem::complete(self : ChecklistItem, evidence : String) -> ChecklistItem

    Mark a checklist item as done.

    ChecklistItem::new

    fn ChecklistItem::new(id : String, title : String, description? : String, done? : Bool, evidence? : String, required? : Bool) -> ChecklistItem

    Create a checklist item.

    ChecklistItem::pending

    fn ChecklistItem::pending(self : ChecklistItem, evidence? : String) -> ChecklistItem

    Mark a checklist item as pending.

    ChecklistItem::to_json

    fn ChecklistItem::to_json(self : ChecklistItem) -> String

    Render a checklist item as JSON.

    ChecklistItem::to_markdown_row

    fn ChecklistItem::to_markdown_row(self : ChecklistItem) -> String

    Render a checklist item as Markdown row.

    ComparisonReport

    pub(all) struct ComparisonReport {
    comparisons : Array[NamedComparison]
    summary : TrendSummary
    } derive(Eq,
    Debug
    )

    A full baseline comparison report.

    ComparisonReport::from_comparisons

    fn ComparisonReport::from_comparisons(comparisons : Array[NamedComparison]) -> ComparisonReport

    Build a comparison report from rows.

    ComparisonReport::to_json

    fn ComparisonReport::to_json(self : ComparisonReport) -> String

    Render a comparison report as compact JSON.

    ComparisonReport::to_markdown

    fn ComparisonReport::to_markdown(self : ComparisonReport) -> String

    Render a comparison report as Markdown.

    DocTemplate

    pub(all) struct DocTemplate {
    id : String
    title : String
    audience : String
    purpose : String
    body : String
    required : Bool
    } derive(Eq,
    Debug
    )

    A reusable documentation template fragment.

    DocTemplate::new

    fn DocTemplate::new(id : String, title : String, audience? : String, purpose? : String, body? : String, required? : Bool) -> DocTemplate

    Create a documentation template fragment.

    DocTemplate::to_json

    fn DocTemplate::to_json(self : DocTemplate) -> String

    Render a documentation template as JSON.

    DocTemplate::to_markdown

    fn DocTemplate::to_markdown(self : DocTemplate) -> String

    Render a documentation template as Markdown.

    DocTemplate::to_markdown_row

    fn DocTemplate::to_markdown_row(self : DocTemplate) -> String

    Render a template as Markdown row.

    DocTemplateSet

    pub(all) struct DocTemplateSet {
    title : String
    templates : Array[DocTemplate]
    } derive(Eq,
    Debug
    )

    A documentation template set.

    DocTemplateSet::add

    Append one template.

    DocTemplateSet::contains

    fn DocTemplateSet::contains(self : DocTemplateSet, id : String) -> Bool

    Whether a template exists.

    DocTemplateSet::count

    fn DocTemplateSet::count(self : DocTemplateSet) -> Int

    Number of templates.

    DocTemplateSet::count_audience

    fn DocTemplateSet::count_audience(self : DocTemplateSet, audience : String) -> Int

    Count templates by audience.

    DocTemplateSet::find

    fn DocTemplateSet::find(self : DocTemplateSet, id : String) -> DocTemplate

    Find a template by id.

    DocTemplateSet::moonbench_standard

    fn DocTemplateSet::moonbench_standard() -> DocTemplateSet

    Standard documentation template set for a contest-ready package.

    DocTemplateSet::new

    fn DocTemplateSet::new(title? : String) -> DocTemplateSet

    Create an empty documentation template set.

    DocTemplateSet::render_all

    fn DocTemplateSet::render_all(self : DocTemplateSet) -> String

    Render all template bodies as one Markdown document.

    DocTemplateSet::required_count

    fn DocTemplateSet::required_count(self : DocTemplateSet) -> Int

    Number of required templates.

    DocTemplateSet::to_json

    fn DocTemplateSet::to_json(self : DocTemplateSet) -> String

    Render template set as JSON.

    DocTemplateSet::to_markdown

    fn DocTemplateSet::to_markdown(self : DocTemplateSet) -> String

    Render an index of templates.

    GateDecision

    pub(all) struct GateDecision {
    name : String
    passed : Bool
    status : String
    reason : String
    severity : String
    delta_pct : Double
    sample_count : Int
    cv_pct : Double
    } derive(Eq,
    Debug
    )

    One gate decision for benchmark automation.

    GateDecision::new

    fn GateDecision::new(name : String, passed : Bool, status : String, reason : String, severity? : String, delta_pct? : Double, sample_count? : Int, cv_pct? : Double) -> GateDecision

    Create an explicit gate decision.

    GateDecision::to_json

    fn GateDecision::to_json(self : GateDecision) -> String

    Render a gate decision as compact JSON.

    GateDecision::to_markdown_row

    fn GateDecision::to_markdown_row(self : GateDecision) -> String

    Render a gate decision as Markdown row.

    GateReport

    pub(all) struct GateReport {
    policy : ThresholdPolicy
    decisions : Array[GateDecision]
    } derive(Eq,
    Debug
    )

    A collection of gate decisions.

    GateReport::add

    fn GateReport::add(self : GateReport, decision : GateDecision) -> GateReport

    Return a new report with one decision appended.

    GateReport::count

    fn GateReport::count(self : GateReport) -> Int

    Number of gate decisions.

    GateReport::failed_count

    fn GateReport::failed_count(self : GateReport) -> Int

    Number of failed decisions.

    GateReport::from_comparison_report

    fn GateReport::from_comparison_report(report : ComparisonReport, policy? : ThresholdPolicy) -> GateReport

    Evaluate a comparison report with a threshold policy.

    GateReport::from_suite_samples

    fn GateReport::from_suite_samples(suite : BenchmarkSuite, policy? : ThresholdPolicy) -> GateReport

    Evaluate raw benchmark results without baselines for sample quality.

    GateReport::new

    fn GateReport::new(policy? : ThresholdPolicy) -> GateReport

    Create an empty gate report.

    GateReport::passed

    fn GateReport::passed(self : GateReport) -> Bool

    Whether every decision passes.

    GateReport::passed_count

    fn GateReport::passed_count(self : GateReport) -> Int

    Number of passed decisions.

    GateReport::to_json

    fn GateReport::to_json(self : GateReport) -> String

    Render gate report as compact JSON.

    GateReport::to_markdown

    fn GateReport::to_markdown(self : GateReport) -> String

    Render gate report as Markdown.

    GitHubStepSummary

    pub(all) struct GitHubStepSummary {
    title : String
    badges : BadgeSet
    reviewer_summary : ReviewerSummary
    suite : BenchmarkSuite
    gate : GateReport
    } derive(Eq,
    Debug
    )

    A GitHub step summary document.

    GitHubStepSummary::new

    fn GitHubStepSummary::new(title? : String, badges? : BadgeSet, reviewer_summary? : ReviewerSummary, suite? : BenchmarkSuite, gate? : GateReport) -> GitHubStepSummary

    Create a GitHub step summary.

    GitHubStepSummary::to_json

    fn GitHubStepSummary::to_json(self : GitHubStepSummary) -> String

    Render GitHub step summary JSON metadata.

    GitHubStepSummary::to_markdown

    fn GitHubStepSummary::to_markdown(self : GitHubStepSummary) -> String

    Render GitHub step summary Markdown.

    MarkdownDocument

    pub(all) struct MarkdownDocument {
    title : String
    intro : String
    sections : Array[MarkdownSection]
    } derive(Eq,
    Debug
    )

    A composable Markdown document.

    MarkdownDocument::add_section

    Append a section.

    MarkdownDocument::new

    fn MarkdownDocument::new(title : String, intro? : String) -> MarkdownDocument

    Create a Markdown document.

    MarkdownDocument::render

    fn MarkdownDocument::render(self : MarkdownDocument) -> String

    Render the document.

    MarkdownDocument::section

    fn MarkdownDocument::section(self : MarkdownDocument, title : String, body : String, level? : Int) -> MarkdownDocument

    Append a section from title and body.

    MarkdownDocument::section_count

    fn MarkdownDocument::section_count(self : MarkdownDocument) -> Int

    Number of sections.

    MarkdownDocument::with_artifacts

    fn MarkdownDocument::with_artifacts(self : MarkdownDocument, bundle : ArtifactBundle, title? : String) -> MarkdownDocument

    Add an artifact bundle section.

    MarkdownDocument::with_comparison

    fn MarkdownDocument::with_comparison(self : MarkdownDocument, report : ComparisonReport, title? : String) -> MarkdownDocument

    Add a comparison report section.

    MarkdownDocument::with_gate

    fn MarkdownDocument::with_gate(self : MarkdownDocument, gate : GateReport, title? : String) -> MarkdownDocument

    Add a quality gate section.

    MarkdownDocument::with_suite

    fn MarkdownDocument::with_suite(self : MarkdownDocument, suite : BenchmarkSuite, title? : String) -> MarkdownDocument

    Add a benchmark suite section.

    MarkdownSection

    pub(all) struct MarkdownSection {
    title : String
    level : Int
    body : String
    } derive(Eq,
    Debug
    )

    One Markdown section with a title and body.

    MarkdownSection::new

    fn MarkdownSection::new(title : String, body? : String, level? : Int) -> MarkdownSection

    Create a Markdown section.

    MarkdownSection::render

    fn MarkdownSection::render(self : MarkdownSection) -> String

    Render a Markdown section.

    MetricSnapshot

    pub(all) struct MetricSnapshot {
    name : String
    mean_us : Double
    median_us : Double
    p90_us : Double
    p95_us : Double
    stddev_us : Double
    samples : Int
    } derive(Eq,
    Debug
    )

    One named metric captured from a benchmark run.

    MetricSnapshot::from_result

    fn MetricSnapshot::from_result(result : BenchmarkResult) -> MetricSnapshot

    Create a metric snapshot from a benchmark result.

    MetricSnapshot::new

    fn MetricSnapshot::new(name : String, mean_us : Double, median_us? : Double, p90_us? : Double, p95_us? : Double, stddev_us? : Double, samples? : Int) -> MetricSnapshot

    Create a metric snapshot.

    MetricSnapshot::to_baseline_line

    fn MetricSnapshot::to_baseline_line(self : MetricSnapshot) -> String

    Render a metric snapshot as baseline entry text.

    MetricSnapshot::to_json

    fn MetricSnapshot::to_json(self : MetricSnapshot) -> String

    Render a metric snapshot as JSON.

    MetricSnapshot::to_markdown_row

    fn MetricSnapshot::to_markdown_row(self : MetricSnapshot) -> String

    Render a metric snapshot as Markdown row.

    NamedComparison

    pub(all) struct NamedComparison {
    name : String
    baseline_found : Bool
    baseline_mean_us : Double
    current_mean_us : Double
    delta_pct : Double
    status : String
    } derive(Eq,
    Debug
    )

    One comparison row that preserves missing-baseline status.

    NamedComparison::to_json

    fn NamedComparison::to_json(self : NamedComparison) -> String

    Render one named comparison as compact JSON.

    NamedComparison::to_markdown_row

    fn NamedComparison::to_markdown_row(self : NamedComparison) -> String

    Render one comparison row as Markdown.

    ProjectScorecard

    pub(all) struct ProjectScorecard {
    title : String
    target_loc : Int
    actual_loc : Int
    sections : Array[ScoreSection]
    } derive(Eq,
    Debug
    )

    Full project scorecard.

    ProjectScorecard::add_section

    fn ProjectScorecard::add_section(self : ProjectScorecard, section : ScoreSection) -> ProjectScorecard

    Append a score section.

    ProjectScorecard::earned_score

    fn ProjectScorecard::earned_score(self : ProjectScorecard) -> Int

    Total earned score.

    ProjectScorecard::grade

    fn ProjectScorecard::grade(self : ProjectScorecard) -> String

    Grade from the current score ratio.

    ProjectScorecard::item_count

    fn ProjectScorecard::item_count(self : ProjectScorecard) -> Int

    Number of score items.

    ProjectScorecard::loc_ready

    fn ProjectScorecard::loc_ready(self : ProjectScorecard) -> Bool

    Whether LOC target is reached.

    ProjectScorecard::max_score

    fn ProjectScorecard::max_score(self : ProjectScorecard) -> Int

    Total maximum score.

    ProjectScorecard::missing_required_count

    fn ProjectScorecard::missing_required_count(self : ProjectScorecard) -> Int

    Missing required item count.

    ProjectScorecard::moonbench_standard

    fn ProjectScorecard::moonbench_standard(actual_loc? : Int) -> ProjectScorecard

    Build the standard excellent-work scorecard.

    ProjectScorecard::new

    fn ProjectScorecard::new(title? : String, target_loc? : Int, actual_loc? : Int) -> ProjectScorecard

    Create an empty project scorecard.

    ProjectScorecard::ratio

    fn ProjectScorecard::ratio(self : ProjectScorecard) -> Double

    Score ratio.

    ProjectScorecard::ready

    fn ProjectScorecard::ready(self : ProjectScorecard) -> Bool

    Whether all required items and LOC target pass.

    ProjectScorecard::section_count

    fn ProjectScorecard::section_count(self : ProjectScorecard) -> Int

    Number of sections.

    ProjectScorecard::to_json

    fn ProjectScorecard::to_json(self : ProjectScorecard) -> String

    Render scorecard as JSON.

    ProjectScorecard::to_markdown

    fn ProjectScorecard::to_markdown(self : ProjectScorecard) -> String

    Render scorecard as Markdown.

    ReleaseNoteEntry

    pub(all) struct ReleaseNoteEntry {
    kind : String
    title : String
    detail : String
    issue : String
    } derive(Eq,
    Debug
    )

    A release note entry.

    ReleaseNoteEntry::new

    fn ReleaseNoteEntry::new(kind : String, title : String, detail? : String, issue? : String) -> ReleaseNoteEntry

    Create a release note entry.

    ReleaseNoteEntry::to_json

    fn ReleaseNoteEntry::to_json(self : ReleaseNoteEntry) -> String

    Render release note entry as JSON.

    ReleaseNoteEntry::to_markdown

    fn ReleaseNoteEntry::to_markdown(self : ReleaseNoteEntry) -> String

    Render release note entry as Markdown bullet.

    ReleaseNotes

    pub(all) struct ReleaseNotes {
    version : String
    date : String
    entries : Array[ReleaseNoteEntry]
    } derive(Eq,
    Debug
    )

    Release notes for a package version.

    ReleaseNotes::add

    Append a release note entry.

    ReleaseNotes::count

    fn ReleaseNotes::count(self : ReleaseNotes) -> Int

    Count entries.

    ReleaseNotes::count_kind

    fn ReleaseNotes::count_kind(self : ReleaseNotes, kind : String) -> Int

    Count entries by kind.

    ReleaseNotes::moonbench_0_2_0

    fn ReleaseNotes::moonbench_0_2_0() -> ReleaseNotes

    Standard release notes for MoonBench 0.2.0.

    ReleaseNotes::moonbench_0_3_0

    fn ReleaseNotes::moonbench_0_3_0() -> ReleaseNotes

    Standard release notes for MoonBench 0.3.0.

    ReleaseNotes::new

    fn ReleaseNotes::new(version : String, date? : String) -> ReleaseNotes

    Create release notes.

    ReleaseNotes::to_json

    fn ReleaseNotes::to_json(self : ReleaseNotes) -> String

    Render release notes as JSON.

    ReleaseNotes::to_markdown

    fn ReleaseNotes::to_markdown(self : ReleaseNotes) -> String

    Render release notes as Markdown.

    ReportMetadata

    pub(all) struct ReportMetadata {
    title : String
    package_name : String
    package_version : String
    target : String
    note : String
    } derive(Eq,
    Debug
    )

    Human-readable metadata attached to a benchmark report.

    ReportMetadata::new

    fn ReportMetadata::new(title? : String, package_name? : String, package_version? : String, target? : String, note? : String) -> ReportMetadata

    Create report metadata with practical defaults.

    ReportMetadata::to_json

    fn ReportMetadata::to_json(self : ReportMetadata) -> String

    Render metadata as compact JSON.

    ReportMetadata::to_markdown

    fn ReportMetadata::to_markdown(self : ReportMetadata) -> String

    Render metadata as a small Markdown block.

    ReviewerSummary

    pub(all) struct ReviewerSummary {
    project : String
    package_name : String
    version : String
    github_url : String
    package_url : String
    highlights : Array[String]
    verification : Array[String]
    } derive(Eq,
    Debug
    )

    A summary card for judges and project reviewers.

    ReviewerSummary::add_highlight

    fn ReviewerSummary::add_highlight(self : ReviewerSummary, highlight : String) -> ReviewerSummary

    Add a highlight.

    ReviewerSummary::add_verification

    fn ReviewerSummary::add_verification(self : ReviewerSummary, line : String) -> ReviewerSummary

    Add a verification command or evidence line.

    ReviewerSummary::moonbench_standard

    fn ReviewerSummary::moonbench_standard() -> ReviewerSummary

    Standard reviewer summary for MoonBench.

    ReviewerSummary::new

    fn ReviewerSummary::new(project? : String, package_name? : String, version? : String, github_url? : String, package_url? : String) -> ReviewerSummary

    Create a reviewer summary.

    ReviewerSummary::to_json

    fn ReviewerSummary::to_json(self : ReviewerSummary) -> String

    Render reviewer summary as JSON.

    ReviewerSummary::to_markdown

    fn ReviewerSummary::to_markdown(self : ReviewerSummary) -> String

    Render reviewer summary as Markdown.

    SampleSeries

    pub(all) struct SampleSeries {
    name : String
    unit : String
    values : Array[Double]
    } derive(Eq,
    Debug
    )

    A named numeric series used for trend analysis.

    SampleSeries::add

    fn SampleSeries::add(self : SampleSeries, value : Double) -> SampleSeries

    Return a new series with one value appended.

    SampleSeries::add_many

    fn SampleSeries::add_many(self : SampleSeries, more : Array[Double]) -> SampleSeries

    Return a new series with many values appended.

    SampleSeries::analyze

    fn SampleSeries::analyze(self : SampleSeries, tolerance_pct? : Double, noisy_cv_pct? : Double) -> TrendAnalysis

    Analyze distribution and trend of a series.

    SampleSeries::coefficient_of_variation_pct

    fn SampleSeries::coefficient_of_variation_pct(self : SampleSeries) -> Double

    Coefficient of variation in percent.

    SampleSeries::count

    fn SampleSeries::count(self : SampleSeries) -> Int

    Number of values in the series.

    SampleSeries::from_result

    fn SampleSeries::from_result(result : BenchmarkResult) -> SampleSeries

    Create a series from an existing benchmark result.

    SampleSeries::high_outlier_count

    fn SampleSeries::high_outlier_count(self : SampleSeries, z_limit? : Double) -> Int

    Count values that are above the mean by at least z_limit sample stddevs.

    SampleSeries::is_empty

    fn SampleSeries::is_empty(self : SampleSeries) -> Bool

    Whether the series has no values.

    SampleSeries::latest

    fn SampleSeries::latest(self : SampleSeries) -> Double

    Latest value in insertion order.

    SampleSeries::latest_delta

    fn SampleSeries::latest_delta(self : SampleSeries) -> Double

    Delta between latest and previous values.

    SampleSeries::latest_delta_pct

    fn SampleSeries::latest_delta_pct(self : SampleSeries) -> Double

    Percentage delta between latest and previous values.

    SampleSeries::low_outlier_count

    fn SampleSeries::low_outlier_count(self : SampleSeries, z_limit? : Double) -> Int

    Count values that are below the mean by at least z_limit sample stddevs.

    SampleSeries::max

    fn SampleSeries::max(self : SampleSeries) -> Double

    Maximum value in the series.

    SampleSeries::mean

    fn SampleSeries::mean(self : SampleSeries) -> Double

    Mean value in the series.

    SampleSeries::median

    fn SampleSeries::median(self : SampleSeries) -> Double

    Median value in the series.

    SampleSeries::min

    fn SampleSeries::min(self : SampleSeries) -> Double

    Minimum value in the series.

    SampleSeries::moving_average

    fn SampleSeries::moving_average(self : SampleSeries, window : Int) -> SampleSeries

    Moving average series with a fixed window.

    SampleSeries::new

    fn SampleSeries::new(name? : String, unit? : String) -> SampleSeries

    Create an empty numeric series.

    SampleSeries::normalize_to_first

    fn SampleSeries::normalize_to_first(self : SampleSeries) -> SampleSeries

    Normalize values by the first value.

    SampleSeries::normalize_to_mean

    fn SampleSeries::normalize_to_mean(self : SampleSeries) -> SampleSeries

    Normalize values by the mean.

    SampleSeries::outlier_count

    fn SampleSeries::outlier_count(self : SampleSeries, z_limit? : Double) -> Int

    Count all z-score outliers.

    SampleSeries::p90

    fn SampleSeries::p90(self : SampleSeries) -> Double

    90th percentile value.

    SampleSeries::p95

    fn SampleSeries::p95(self : SampleSeries) -> Double

    95th percentile value.

    SampleSeries::percentile

    fn SampleSeries::percentile(self : SampleSeries, percentile : Int) -> Double

    Nearest-rank percentile value in the series.

    SampleSeries::population_stddev

    fn SampleSeries::population_stddev(self : SampleSeries) -> Double

    Population standard deviation.

    SampleSeries::population_variance

    fn SampleSeries::population_variance(self : SampleSeries) -> Double

    Population variance.

    SampleSeries::previous

    fn SampleSeries::previous(self : SampleSeries) -> Double

    Previous value in insertion order.

    SampleSeries::range

    fn SampleSeries::range(self : SampleSeries) -> Double

    Difference between max and min.

    SampleSeries::sample_stddev

    fn SampleSeries::sample_stddev(self : SampleSeries) -> Double

    Sample standard deviation.

    SampleSeries::sample_variance

    fn SampleSeries::sample_variance(self : SampleSeries) -> Double

    Sample variance.

    SampleSeries::sorted

    fn SampleSeries::sorted(self : SampleSeries) -> Array[Double]

    Sort values ascending without mutating the original series.

    SampleSeries::stable_ratio

    fn SampleSeries::stable_ratio(self : SampleSeries, tolerance_pct? : Double) -> Double

    Ratio of values within percent tolerance of the mean.

    SampleSeries::sum

    fn SampleSeries::sum(self : SampleSeries) -> Double

    Sum all values in the series.

    SampleSeries::take

    fn SampleSeries::take(self : SampleSeries, limit : Int) -> SampleSeries

    Return the first limit values from the series.

    SampleSeries::take_last

    fn SampleSeries::take_last(self : SampleSeries, limit : Int) -> SampleSeries

    Return the last limit values from the series.

    SampleSeries::to_array

    fn SampleSeries::to_array(self : SampleSeries) -> Array[Double]

    Copy values as a new array.

    SampleSeries::to_json

    fn SampleSeries::to_json(self : SampleSeries) -> String

    Render the series as a compact JSON array document.

    SampleSeries::to_markdown

    fn SampleSeries::to_markdown(self : SampleSeries) -> String

    Render the series as a Markdown table.

    SampleStats

    pub(all) struct SampleStats {
    count : Int
    min_us : Double
    max_us : Double
    mean_us : Double
    median_us : Double
    p90_us : Double
    p95_us : Double
    stddev_us : Double
    } derive(Eq,
    Debug
    )

    A statistical summary of benchmark samples measured in microseconds.

    SampleStats::from_samples

    fn SampleStats::from_samples(samples : Array[Double]) -> SampleStats

    Create a summary from an array of samples measured in microseconds.

    SampleStats::to_json

    fn SampleStats::to_json(self : SampleStats) -> String

    Render sample statistics as JSON.

    ScenarioCatalog

    pub(all) struct ScenarioCatalog {
    title : String
    scenarios : Array[WorkloadScenario]
    } derive(Eq,
    Debug
    )

    A catalog of recommended workload scenarios.

    ScenarioCatalog::add

    Append one scenario.

    ScenarioCatalog::average_priority

    fn ScenarioCatalog::average_priority(self : ScenarioCatalog) -> Double

    Average priority across scenarios.

    ScenarioCatalog::contains_id

    fn ScenarioCatalog::contains_id(self : ScenarioCatalog, id : String) -> Bool

    Whether the catalog contains a scenario id.

    ScenarioCatalog::count

    fn ScenarioCatalog::count(self : ScenarioCatalog) -> Int

    Number of scenarios.

    ScenarioCatalog::count_category

    fn ScenarioCatalog::count_category(self : ScenarioCatalog, category : String) -> Int

    Count scenarios by category.

    ScenarioCatalog::count_tag

    fn ScenarioCatalog::count_tag(self : ScenarioCatalog, tag : String) -> Int

    Count scenarios by tag.

    ScenarioCatalog::estimated_suite

    fn ScenarioCatalog::estimated_suite(self : ScenarioCatalog) -> BenchmarkSuite

    Build a suite with manual estimated costs for all scenarios.

    ScenarioCatalog::filter_category

    fn ScenarioCatalog::filter_category(self : ScenarioCatalog, category : String) -> ScenarioCatalog

    Filter scenarios by category.

    ScenarioCatalog::filter_priority

    fn ScenarioCatalog::filter_priority(self : ScenarioCatalog, minimum_priority : Int) -> ScenarioCatalog

    Filter scenarios with priority greater than or equal to threshold.

    ScenarioCatalog::filter_tag

    fn ScenarioCatalog::filter_tag(self : ScenarioCatalog, tag : String) -> ScenarioCatalog

    Filter scenarios by tag.

    ScenarioCatalog::find

    fn ScenarioCatalog::find(self : ScenarioCatalog, id : String) -> WorkloadScenario

    Find a scenario by id.

    ScenarioCatalog::moonbench_standard

    fn ScenarioCatalog::moonbench_standard() -> ScenarioCatalog

    Build the standard MoonBench scenario catalog.

    ScenarioCatalog::new

    fn ScenarioCatalog::new(title? : String) -> ScenarioCatalog

    Create an empty scenario catalog.

    ScenarioCatalog::to_json

    fn ScenarioCatalog::to_json(self : ScenarioCatalog) -> String

    Render catalog as JSON.

    ScenarioCatalog::to_markdown

    fn ScenarioCatalog::to_markdown(self : ScenarioCatalog) -> String

    Render catalog as Markdown.

    ScenarioCatalog::total_iterations

    fn ScenarioCatalog::total_iterations(self : ScenarioCatalog) -> Int

    Total planned iterations in the catalog.

    ScoreItem

    pub(all) struct ScoreItem {
    id : String
    title : String
    description : String
    max_score : Int
    earned_score : Int
    passed : Bool
    evidence : String
    required : Bool
    } derive(Eq,
    Debug
    )

    One score item in a project rubric.

    ScoreItem::fail

    fn ScoreItem::fail(self : ScoreItem, evidence : String) -> ScoreItem

    Mark an item as failed.

    ScoreItem::new

    fn ScoreItem::new(id : String, title : String, description? : String, max_score? : Int, earned_score? : Int, passed? : Bool, evidence? : String, required? : Bool) -> ScoreItem

    Create a score item.

    ScoreItem::partial

    fn ScoreItem::partial(self : ScoreItem, score : Int, evidence : String) -> ScoreItem

    Mark an item as partially earned.

    ScoreItem::pass

    fn ScoreItem::pass(self : ScoreItem, evidence : String) -> ScoreItem

    Mark an item as fully passed.

    ScoreItem::ratio

    fn ScoreItem::ratio(self : ScoreItem) -> Double

    Completion ratio for the item.

    ScoreItem::to_json

    fn ScoreItem::to_json(self : ScoreItem) -> String

    Render score item as JSON.

    ScoreItem::to_markdown_row

    fn ScoreItem::to_markdown_row(self : ScoreItem) -> String

    Render score item as Markdown row.

    ScoreSection

    pub(all) struct ScoreSection {
    id : String
    title : String
    items : Array[ScoreItem]
    } derive(Eq,
    Debug
    )

    A score section in a project rubric.

    ScoreSection::add

    fn ScoreSection::add(self : ScoreSection, item : ScoreItem) -> ScoreSection

    Append an item.

    ScoreSection::count

    fn ScoreSection::count(self : ScoreSection) -> Int

    Number of score items.

    ScoreSection::earned_score

    fn ScoreSection::earned_score(self : ScoreSection) -> Int

    Earned score in this section.

    ScoreSection::max_score

    fn ScoreSection::max_score(self : ScoreSection) -> Int

    Maximum score in this section.

    ScoreSection::missing_required_count

    fn ScoreSection::missing_required_count(self : ScoreSection) -> Int

    Missing required items in this section.

    ScoreSection::new

    fn ScoreSection::new(id : String, title : String) -> ScoreSection

    Create an empty score section.

    ScoreSection::ratio

    fn ScoreSection::ratio(self : ScoreSection) -> Double

    Ratio for this section.

    ScoreSection::required_passed

    fn ScoreSection::required_passed(self : ScoreSection) -> Bool

    Whether all required items in this section pass.

    ScoreSection::to_json

    fn ScoreSection::to_json(self : ScoreSection) -> String

    Render section as JSON.

    ScoreSection::to_markdown

    fn ScoreSection::to_markdown(self : ScoreSection) -> String

    Render section as Markdown.

    SnapshotDiff

    pub(all) struct SnapshotDiff {
    name : String
    before_found : Bool
    after_found : Bool
    before_mean_us : Double
    after_mean_us : Double
    delta_us : Double
    delta_pct : Double
    status : String
    } derive(Eq,
    Debug
    )

    One comparison between two metric snapshots.

    SnapshotDiff::new

    fn SnapshotDiff::new(name : String, before_found : Bool, after_found : Bool, before_mean_us : Double, after_mean_us : Double, tolerance_pct? : Double) -> SnapshotDiff

    Create a snapshot diff row.

    SnapshotDiff::to_json

    fn SnapshotDiff::to_json(self : SnapshotDiff) -> String

    Render diff row as JSON.

    SnapshotDiff::to_markdown_row

    fn SnapshotDiff::to_markdown_row(self : SnapshotDiff) -> String

    Render diff row as Markdown.

    SnapshotDiffReport

    pub(all) struct SnapshotDiffReport {
    before_label : String
    after_label : String
    diffs : Array[SnapshotDiff]
    } derive(Eq,
    Debug
    )

    Full diff between two snapshots.

    SnapshotDiffReport::count

    fn SnapshotDiffReport::count(self : SnapshotDiffReport) -> Int

    Number of diff rows.

    SnapshotDiffReport::count_status

    fn SnapshotDiffReport::count_status(self : SnapshotDiffReport, status : String) -> Int

    Count rows by status.

    SnapshotDiffReport::has_regression

    fn SnapshotDiffReport::has_regression(self : SnapshotDiffReport) -> Bool

    Whether the diff has any slower rows.

    SnapshotDiffReport::is_clean

    fn SnapshotDiffReport::is_clean(self : SnapshotDiffReport) -> Bool

    Whether the diff only contains stable or faster matched rows.

    SnapshotDiffReport::to_gate_report

    fn SnapshotDiffReport::to_gate_report(self : SnapshotDiffReport, policy? : ThresholdPolicy) -> GateReport

    Convert snapshot diff into a gate report.

    SnapshotDiffReport::to_json

    fn SnapshotDiffReport::to_json(self : SnapshotDiffReport) -> String

    Render snapshot diff as JSON.

    SnapshotDiffReport::to_markdown

    fn SnapshotDiffReport::to_markdown(self : SnapshotDiffReport) -> String

    Render snapshot diff as Markdown.

    StatusBadge

    pub(all) struct StatusBadge {
    label : String
    message : String
    color : String
    link : String
    } derive(Eq,
    Debug
    )

    A compact status badge for README, CI summary, or release notes.

    StatusBadge::new

    fn StatusBadge::new(label : String, message : String, color? : String, link? : String) -> StatusBadge

    Create a status badge.

    StatusBadge::to_json

    fn StatusBadge::to_json(self : StatusBadge) -> String

    Render badge JSON.

    StatusBadge::to_markdown

    fn StatusBadge::to_markdown(self : StatusBadge) -> String

    Render badge Markdown.

    StatusBadge::url

    fn StatusBadge::url(self : StatusBadge) -> String

    Render a shields.io badge URL.

    Stopwatch

    pub(all) struct Stopwatch {
    elapsed_us : Int
    started_at_us : Int
    running : Bool
    } derive(Eq,
    Debug
    )

    A pure stopwatch state measured in microseconds.

    Stopwatch::elapsed

    fn Stopwatch::elapsed(self : Stopwatch, now_us : Int) -> Int

    Return elapsed microseconds at now_us without changing the state.

    Stopwatch::lap

    fn Stopwatch::lap(self : Stopwatch, now_us : Int) -> (Int, Stopwatch)

    Record a lap at now_us, returning the lap duration and updated stopwatch.

    Stopwatch::new

    fn Stopwatch::new() -> Stopwatch

    Create a stopped stopwatch with no elapsed time.

    Stopwatch::reset

    fn Stopwatch::reset(_self : Stopwatch) -> Stopwatch

    Reset elapsed time and return to the stopped state.

    Stopwatch::start

    fn Stopwatch::start(self : Stopwatch, now_us : Int) -> Stopwatch

    Start the stopwatch at now_us.

    Stopwatch::stop

    fn Stopwatch::stop(self : Stopwatch, now_us : Int) -> Stopwatch

    Stop the stopwatch at now_us.

    SubmissionChecklist

    pub(all) struct SubmissionChecklist {
    title : String
    items : Array[ChecklistItem]
    } derive(Eq,
    Debug
    )

    A checklist with completion metrics.

    SubmissionChecklist::add

    Append a checklist item.

    SubmissionChecklist::completion_ratio

    fn SubmissionChecklist::completion_ratio(self : SubmissionChecklist) -> Double

    Completion ratio for all items.

    SubmissionChecklist::count

    fn SubmissionChecklist::count(self : SubmissionChecklist) -> Int

    Number of checklist items.

    SubmissionChecklist::done_count

    fn SubmissionChecklist::done_count(self : SubmissionChecklist) -> Int

    Number of completed items.

    SubmissionChecklist::missing_required_count

    fn SubmissionChecklist::missing_required_count(self : SubmissionChecklist) -> Int

    Number of incomplete required items.

    SubmissionChecklist::moonbench_standard

    fn SubmissionChecklist::moonbench_standard() -> SubmissionChecklist

    Standard checklist for MoonBench contest submission.

    SubmissionChecklist::new

    fn SubmissionChecklist::new(title? : String) -> SubmissionChecklist

    Create an empty submission checklist.

    SubmissionChecklist::ready

    fn SubmissionChecklist::ready(self : SubmissionChecklist) -> Bool

    Whether all required items are complete.

    SubmissionChecklist::required_count

    fn SubmissionChecklist::required_count(self : SubmissionChecklist) -> Int

    Number of required checklist items.

    SubmissionChecklist::to_json

    fn SubmissionChecklist::to_json(self : SubmissionChecklist) -> String

    Render checklist as compact JSON.

    SubmissionChecklist::to_markdown

    fn SubmissionChecklist::to_markdown(self : SubmissionChecklist) -> String

    Render checklist as Markdown.

    ThresholdPolicy

    pub(all) struct ThresholdPolicy {
    name : String
    faster_pct : Double
    slower_pct : Double
    noisy_cv_pct : Double
    minimum_samples : Int
    allow_missing_baseline : Bool
    } derive(Eq,
    Debug
    )

    Policy used by CI quality gates.

    ThresholdPolicy::balanced

    Balanced policy for normal CI.

    ThresholdPolicy::classify_delta

    fn ThresholdPolicy::classify_delta(self : ThresholdPolicy, delta_pct : Double) -> String

    Classify a percentage delta with this policy.

    ThresholdPolicy::has_enough_samples

    fn ThresholdPolicy::has_enough_samples(self : ThresholdPolicy, count : Int) -> Bool

    Whether a sample count satisfies the policy.

    ThresholdPolicy::is_noisy

    fn ThresholdPolicy::is_noisy(self : ThresholdPolicy, cv_pct : Double) -> Bool

    Whether a coefficient of variation is considered noisy.

    ThresholdPolicy::new

    fn ThresholdPolicy::new(name? : String, faster_pct? : Double, slower_pct? : Double, noisy_cv_pct? : Double, minimum_samples? : Int, allow_missing_baseline? : Bool) -> ThresholdPolicy

    Create a custom threshold policy.

    ThresholdPolicy::relaxed

    Relaxed policy for local development.

    ThresholdPolicy::strict

    Strict policy for release gates.

    ThresholdPolicy::to_json

    fn ThresholdPolicy::to_json(self : ThresholdPolicy) -> String

    Render policy as JSON.

    TrendAnalysis

    pub(all) struct TrendAnalysis {
    name : String
    unit : String
    count : Int
    first : Double
    latest : Double
    min : Double
    max : Double
    mean : Double
    median : Double
    p90 : Double
    p95 : Double
    stddev : Double
    latest_delta_pct : Double
    coefficient_of_variation_pct : Double
    stable_ratio : Double
    outlier_count : Int
    direction : String
    risk : String
    } derive(Eq,
    Debug
    )

    Analysis summary for a sample series.

    TrendAnalysis::to_json

    fn TrendAnalysis::to_json(self : TrendAnalysis) -> String

    Render trend analysis as compact JSON.

    TrendAnalysis::to_markdown

    fn TrendAnalysis::to_markdown(self : TrendAnalysis) -> String

    Render trend analysis as Markdown.

    TrendSummary

    pub(all) struct TrendSummary {
    total : Int
    faster : Int
    stable : Int
    slower : Int
    missing_baseline : Int
    best_delta_pct : Double
    worst_delta_pct : Double
    } derive(Eq,
    Debug
    )

    Summary of baseline comparison status counts.

    TrendSummary::to_json

    fn TrendSummary::to_json(self : TrendSummary) -> String

    Render trend summary as compact JSON.

    ValidationIssue

    pub(all) struct ValidationIssue {
    ok : Bool
    message : String
    } derive(Eq,
    Debug
    )

    Validation result for benchmark naming and report hygiene.

    WorkloadScenario

    pub(all) struct WorkloadScenario {
    id : String
    name : String
    category : String
    description : String
    tags : Array[String]
    data_size : Int
    warmup : Int
    iterations : Int
    expected_unit : String
    complexity : String
    priority : Int
    } derive(Eq,
    Debug
    )

    A benchmark workload scenario that can be documented and selected.

    WorkloadScenario::estimated_cost_us

    fn WorkloadScenario::estimated_cost_us(self : WorkloadScenario) -> Double

    Estimate cost in microseconds from scenario metadata.

    WorkloadScenario::has_tag

    fn WorkloadScenario::has_tag(self : WorkloadScenario, tag : String) -> Bool

    Whether the scenario has a tag.

    WorkloadScenario::is_category

    fn WorkloadScenario::is_category(self : WorkloadScenario, category : String) -> Bool

    Whether the scenario belongs to a category.

    WorkloadScenario::new

    fn WorkloadScenario::new(id : String, name : String, category? : String, description? : String, tags? : Array[String], data_size? : Int, warmup? : Int, iterations? : Int, expected_unit? : String, complexity? : String, priority? : Int) -> WorkloadScenario

    Create a workload scenario descriptor.

    WorkloadScenario::runner

    Build a benchmark runner using this scenario's sampling settings.

    WorkloadScenario::tags_text

    fn WorkloadScenario::tags_text(self : WorkloadScenario) -> String

    Render tags as comma-separated text.

    WorkloadScenario::to_json

    fn WorkloadScenario::to_json(self : WorkloadScenario) -> String

    Render a scenario as JSON.

    WorkloadScenario::to_markdown_row

    fn WorkloadScenario::to_markdown_row(self : WorkloadScenario) -> String

    Render a scenario as Markdown row.

    normalize_benchmark_name

    fn normalize_benchmark_name(name : String) -> String

    Normalize a benchmark name for compact console reports.

    validate_benchmark_name

    fn validate_benchmark_name(name : String) -> ValidationIssue

    Validate benchmark names before they appear in reports or CI artifacts.