26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
use criterion::{Criterion, criterion_group, criterion_main};
|
|
use std::hint::black_box;
|
|
|
|
fn bench_compress_git_status(c: &mut Criterion) {
|
|
let output = "On branch main\nYour branch is up to date with 'origin/main'.\n\nChanges not staged for commit:\n modified: src/main.rs\n modified: src/lib.rs\n\nno changes added to commit";
|
|
c.bench_function("compress_git_status", |b| {
|
|
b.iter(|| {
|
|
lean_ctx::core::patterns::compress_output(black_box("git status"), black_box(output))
|
|
});
|
|
});
|
|
}
|
|
|
|
fn bench_compress_cargo_build(c: &mut Criterion) {
|
|
let output = " Compiling lean-ctx v3.4.3\n Compiling serde v1.0.200\n Compiling tokio v1.38.0\n Compiling anyhow v1.0.86\n Finished `release` profile in 45.2s";
|
|
c.bench_function("compress_cargo_build", |b| {
|
|
b.iter(|| {
|
|
lean_ctx::core::patterns::compress_output(black_box("cargo build"), black_box(output))
|
|
});
|
|
});
|
|
}
|
|
|
|
fn bench_token_count(c: &mut Criterion) {
|
|
let text = "fn main() {\n println!(\"Hello, world!\");\n}\n".repeat(100);
|
|
c.bench_function("token_count_4k", |b| {
|
|
b.iter(|| lean_ctx::core::tokens::count_tokens(black_box(&text)));
|
|
});
|
|
}
|
|
|
|
criterion_group!(
|
|
benches,
|
|
bench_compress_git_status,
|
|
bench_compress_cargo_build,
|
|
bench_token_count
|
|
);
|
|
criterion_main!(benches);
|