xtrace_sdk.x_vec.utils.bench

Lightweight benchmark context manager.

Enabled by setting the XTRACE_BENCHMARK environment variable to 1 or true. When disabled, bench() is a zero-cost no-op.

Attributes

Functions

bench(label)

Time a block and log the result when XTRACE_BENCHMARK is enabled.

Module Contents

xtrace_sdk.x_vec.utils.bench._log
xtrace_sdk.x_vec.utils.bench._ENABLED
xtrace_sdk.x_vec.utils.bench.bench(label)

Time a block and log the result when XTRACE_BENCHMARK is enabled.

Usage:

with bench("query_encrypt"):
    encrypted = client.encrypt_vec_one(vec)
Parameters:

label (str)

Return type:

Generator[None, None, None]