Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/suggest/benches/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  benchmark_all.rs

  Sprache: Rust
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */


use criterion::{criterion_group, measurement::Measurement, BatchSize, BenchmarkGroup, Criterion};
use std::sync::Once;
use suggest::benchmarks::{cleanup, geoname, ingest, query, BenchmarkWithInput};

pub fn geoname(c: &mut Criterion) {
    setup_viaduct();
    let group = c.benchmark_group("geoname");
    run_benchmarks(group, geoname::all_benchmarks())
}

pub fn ingest(c: &mut Criterion) {
    setup_viaduct();
    let mut group = c.benchmark_group("ingest");
    // This needs to be 10 for now, or else the `ingest-amp-wikipedia` benchmark would take around
    // 100s to run which feels like too long.  `ingest-amp-mobile` also would take a around 50s.
    group.sample_size(10);
    run_benchmarks(group, ingest::all_benchmarks())
}

pub fn query(c: &mut Criterion) {
    setup_viaduct();
    let group = c.benchmark_group("query");
    run_benchmarks(group, query::all_benchmarks())
}

fn run_benchmarks<B: BenchmarkWithInput, M: Measurement>(
    mut group: BenchmarkGroup<M>,
    benchmarks: Vec<(&'static str, B)>,
) {
    for (name, benchmark) in benchmarks {
        let g_input = benchmark.global_input();
        group.bench_function(name.to_string(), |b| {
            b.iter_batched(
                || benchmark.iteration_input(),
                |i_input| benchmark.benchmarked_code(&g_input, i_input),
                // See https://docs.rs/criterion/latest/criterion/enum.BatchSize.html#variants for
                // a discussion of this.  PerIteration is chosen for these benchmarks because the
                // input holds a database file handle
                BatchSize::PerIteration,
            );
        });
    }
    group.finish();
}

fn setup_viaduct() {
    static INIT: Once = Once::new();
    INIT.call_once(viaduct_reqwest::use_reqwest_backend);
}

criterion_group!(benches, geoname, ingest, query);

fn main() {
    benches();
    criterion::Criterion::default()
        .configure_from_args()
        .final_summary();
    cleanup();
}

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-23) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.