MCPcopy Index your code
hub / github.com/MinishLab/semble / _bench_coderankembed

Function _bench_coderankembed

benchmarks/speed_benchmark.py:118–129  ·  view source on GitHub ↗

Index a repo with CodeRankEmbed via semble and measure query latency; return (index_ms, latencies_ms).

(spec: RepoSpec, tasks: list[Task], model: _CREWrapper)

Source from the content-addressed store, hash-verified

116
117
118def _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
132def _bench_colgrep(spec: RepoSpec, tasks: list[Task]) -> tuple[float, tuple[float, ...]] | None:

Callers 1

mainFunction · 0.85

Calls 2

searchMethod · 0.80
from_pathMethod · 0.45

Tested by

no test coverage detected