Benchmark the IN (...) query used by _discover_manpage_suggestions.
(
conn: sqlite3.Connection,
src_groups: list[list[str]],
iterations: int,
)
| 103 | |
| 104 | |
| 105 | def bench_in_query( |
| 106 | conn: sqlite3.Connection, |
| 107 | src_groups: list[list[str]], |
| 108 | iterations: int, |
| 109 | ) -> list[float]: |
| 110 | """Benchmark the IN (...) query used by _discover_manpage_suggestions.""" |
| 111 | times: list[float] = [] |
| 112 | for i in range(iterations): |
| 113 | group = src_groups[i % len(src_groups)] |
| 114 | query = build_query_in(len(group)) |
| 115 | start = time.perf_counter() |
| 116 | conn.execute(query, group).fetchall() |
| 117 | elapsed = time.perf_counter() - start |
| 118 | times.append(elapsed) |
| 119 | return times |
| 120 | |
| 121 | |
| 122 | def report(label: str, times: list[float]) -> dict[str, float]: |
no test coverage detected