Index a repo with CodeRankEmbed via semble and measure query latency; return (index_ms, latencies_ms).
(spec: RepoSpec, tasks: list[Task], model: _CREWrapper)
| 116 | |
| 117 | |
| 118 | def _bench_coderankembed(spec: RepoSpec, tasks: list[Task], model: _CREWrapper) -> tuple[float, tuple[float, ...]]: |
| 119 | """Index a repo with CodeRankEmbed via semble and measure query latency; return (index_ms, latencies_ms).""" |
| 120 | started = time.perf_counter() |
| 121 | index = SembleIndex.from_path(spec.benchmark_dir, model=model) |
| 122 | index_ms = (time.perf_counter() - started) * 1000 |
| 123 | latencies: list[float] = [] |
| 124 | for task in tasks: |
| 125 | for _ in range(5): |
| 126 | started = time.perf_counter() |
| 127 | index.search(task.query, top_k=_TOP_K, mode="semantic") |
| 128 | latencies.append((time.perf_counter() - started) * 1000) |
| 129 | return index_ms, tuple(latencies) |
| 130 | |
| 131 | |
| 132 | def _bench_colgrep(spec: RepoSpec, tasks: list[Task]) -> tuple[float, tuple[float, ...]] | None: |