Download packages/session-backends/sqlite-node/benchmark/session/session-repo.bench.ts from SaylorTwift/pi: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/SaylorTwift/pi/resolve/main/packages/session-backends/sqlite-node/benchmark/session/session-repo.bench.ts
- Command line
-
hf download hf://SaylorTwift/pi/packages/session-backends/sqlite-node/benchmark/session/session-repo.bench.ts
-
curl -L -o session-repo.bench.ts https://huggingface.co/SaylorTwift/pi/resolve/main/packages/session-backends/sqlite-node/benchmark/session/session-repo.bench.ts
1.91 kB
| import { | |
| SESSION_REPO_CATALOG_BENCHMARK_DATASETS, | |
| SESSION_REPO_CATALOG_READ_BENCHMARK_SCENARIOS, | |
| SESSION_REPO_CATALOG_WRITE_BENCHMARK_SCENARIOS, | |
| SESSION_REPO_FORK_BENCHMARK_DATASETS, | |
| SESSION_REPO_FORK_WRITE_BENCHMARK_SCENARIOS, | |
| seedSessionRepoCatalogBenchmark, | |
| seedSessionRepoForkBenchmark, | |
| } from "@earendil-works/pi-agent-core/harness/session/testing"; | |
| import { registerReadBenchmarks, registerWriteBenchmarks } from "../../../../agent/benchmark/session/benchmark.ts"; | |
| import { sessionRepoBenchmarkTargets } from "./session-repo-targets.ts"; | |
| await registerReadBenchmarks({ | |
| datasets: SESSION_REPO_CATALOG_BENCHMARK_DATASETS, | |
| targets: sessionRepoBenchmarkTargets, | |
| scenarios: SESSION_REPO_CATALOG_READ_BENCHMARK_SCENARIOS, | |
| async prepare(fixture, dataset) { | |
| await seedSessionRepoCatalogBenchmark(fixture.repo, dataset); | |
| }, | |
| getSubject(fixture) { | |
| return fixture.repo; | |
| }, | |
| }); | |
| await registerWriteBenchmarks({ | |
| targets: sessionRepoBenchmarkTargets, | |
| scenarios: SESSION_REPO_CATALOG_WRITE_BENCHMARK_SCENARIOS, | |
| prepare(fixture, scenario) { | |
| return scenario.prepare(fixture.repo); | |
| }, | |
| expectedResult(scenario) { | |
| return scenario.expectedResult; | |
| }, | |
| run(operation) { | |
| return operation.run(); | |
| }, | |
| }); | |
| const forkBenchmarks = SESSION_REPO_FORK_BENCHMARK_DATASETS.flatMap((dataset) => | |
| SESSION_REPO_FORK_WRITE_BENCHMARK_SCENARIOS.map((scenario) => ({ | |
| name: `${scenario.name} (${dataset.name})`, | |
| dataset, | |
| scenario, | |
| })), | |
| ); | |
| await registerWriteBenchmarks({ | |
| targets: sessionRepoBenchmarkTargets, | |
| scenarios: forkBenchmarks, | |
| async prepare(fixture, benchmark) { | |
| return { | |
| repo: fixture.repo, | |
| source: await seedSessionRepoForkBenchmark(fixture.repo, benchmark.dataset), | |
| }; | |
| }, | |
| expectedResult(benchmark) { | |
| return benchmark.scenario.expectedResult(benchmark.dataset); | |
| }, | |
| run(subject, benchmark) { | |
| return benchmark.scenario.run(subject.repo, subject.source, benchmark.dataset); | |
| }, | |
| }); | |