Files
codebase-memory-mcp/scripts/_benchmark_compat.py
T
Andrew Hundt 603e516faf refactor(benchmarks): consolidate canonical assets under benchmarks
Move incremental_speed.py, run_experiments.py, summarize_results.py, fact_comparisons.py, autotune.py, active v2 schemas, terminology.json, configuration spelling data, and shell harnesses into benchmarks/.

Keep scripts/_benchmark_compat.py plus historical Python and shell filenames as thin compatibility frontends. Preserve docs/schema/benchmark-facts-v1.schema.json because retained v1 bundles embed that exact URI; accept the former v2 URI only while loading retained results.

Regenerate docs/BENCHMARK_TERMINOLOGY.md and src/foundation/profile_terms_generated.h from benchmarks/terminology.json. Update CONTRIBUTING.md, MAINTAINERS.md, docs/BENCHMARK_EXPERIMENTS.md, docs/EVALUATION_PLAN.md, and tests to use canonical paths.

Verification: 205 passed, 1 skipped, 34 subtests passed; Ruff E4/E7/E9/F passed; comparisons-v1 schema validation passed for 42 retained bundles and 91 comparisons; generator --check, bash -n, git diff --check, and scripts/check-source-safety.sh passed.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
2026-07-23 20:29:05 -04:00

25 lines
848 B
Python

"""Shared loader for historical benchmark script entry points."""
from __future__ import annotations
import importlib.util
from pathlib import Path
from typing import Any
def load_public(namespace: dict[str, Any], filename: str, module_name: str) -> None:
implementation = Path(__file__).resolve().parents[1] / "benchmarks" / filename
spec = importlib.util.spec_from_file_location(module_name, implementation)
if not spec or not spec.loader:
raise RuntimeError(f"cannot load benchmark implementation: {implementation}")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
namespace["_benchmark_implementation"] = module
namespace.update(
{
name: getattr(module, name)
for name in dir(module)
if not name.startswith("__")
}
)