aura-lang 0.1.0

Aura configuration language: deterministic, capability-secured, schema-validated configs — embeddable library + the `aura` CLI
Documentation
//! Phase 2 hot-path benchmark: the full front end (lex + parse) on the reference manifest.

use std::hint::black_box;

use criterion::{criterion_group, criterion_main, Criterion, Throughput};

const MANIFEST: &str = include_str!("../tests/fixtures/production_deploy.aura");

fn bench_parser(c: &mut Criterion) {
    // Imports must come at the start of the file, so the manifest cannot be concatenated -
    // run 64 independent parses per iteration instead.
    let mut group = c.benchmark_group("parser");
    group.throughput(Throughput::Bytes(MANIFEST.len() as u64 * 64));
    group.bench_function("lex_and_parse_manifest_x64", |b| {
        b.iter(|| {
            for _ in 0..64 {
                let toks = aura_lang::lexer::Lexer::new(black_box(MANIFEST), 0)
                    .tokenize()
                    .unwrap();
                black_box(aura_lang::parser::Parser::new(toks).parse_module().unwrap());
            }
        })
    });
    group.finish();
}

criterion_group!(benches, bench_parser);
criterion_main!(benches);