MCPcopy
hub / github.com/idank/explainshell / bench_query

Function bench_query

tools/bench_src_index.py:87–102  ·  view source on GitHub ↗

Run *query* with each params tuple, cycling through params_list for *iterations* total executions. Return per-query times in seconds.

(
    conn: sqlite3.Connection,
    query: str,
    params_list: list[tuple],
    iterations: int,
)

Source from the content-addressed store, hash-verified

85
86
87def bench_query(
88 conn: sqlite3.Connection,
89 query: str,
90 params_list: list[tuple],
91 iterations: int,
92) -> list[float]:
93 """Run *query* with each params tuple, cycling through params_list for
94 *iterations* total executions. Return per-query times in seconds."""
95 times: list[float] = []
96 for i in range(iterations):
97 params = params_list[i % len(params_list)]
98 start = time.perf_counter()
99 conn.execute(query, params).fetchall()
100 elapsed = time.perf_counter() - start
101 times.append(elapsed)
102 return times
103
104
105def bench_in_query(

Callers 1

run_suiteFunction · 0.85

Calls 1

rangeFunction · 0.85

Tested by

no test coverage detected