boofun.benchmarks

Performance benchmarking module for BooFun library.

This module provides comprehensive benchmarking tools to measure and compare the performance of different Boolean function representations and algorithms.

Functions

run_quick_benchmark()

Run a quick benchmark for development testing.

Classes

PerformanceBenchmark([warmup_runs, ...])

Comprehensive benchmarking suite for Boolean function operations.

class boofun.benchmarks.PerformanceBenchmark(warmup_runs: int = 3, benchmark_runs: int = 10)[source]

Comprehensive benchmarking suite for Boolean function operations.

Measures timing, memory usage, and scalability across different representations and algorithms.

__init__(warmup_runs: int = 3, benchmark_runs: int = 10) None[source]

Initialize benchmark suite.

Parameters:
  • warmup_runs – Number of warmup iterations

  • benchmark_runs – Number of benchmark iterations for averaging

timer() Iterator[Any][source]

Context manager for high-precision timing.

benchmark_function(func: Callable[[...], Any], *args: Any, **kwargs: Any) dict[str, Any][source]

Benchmark a single function with multiple runs.

Parameters:
  • func – Function to benchmark

  • *args – Arguments to pass to function

  • **kwargs

    Arguments to pass to function

Returns:

Dictionary with timing statistics

benchmark_creation(n_vars_range: list[int]) dict[str, Any][source]

Benchmark Boolean function creation across different sizes.

Parameters:

n_vars_range – List of variable counts to test

Returns:

Benchmark results for each method

benchmark_evaluation(n_vars_range: list[int]) dict[str, Any][source]

Benchmark function evaluation performance.

Parameters:

n_vars_range – List of variable counts to test

Returns:

Evaluation benchmark results

benchmark_spectral_analysis(n_vars_range: list[int]) dict[str, Any][source]

Benchmark spectral analysis algorithms.

Parameters:

n_vars_range – List of variable counts to test

Returns:

Spectral analysis benchmark results

benchmark_representations(n_vars: int = 6) dict[str, Any][source]

Compare different representation formats.

Parameters:

n_vars – Number of variables for comparison

Returns:

Representation comparison results

run_comprehensive_benchmark(max_vars: int = 10) dict[str, Any][source]

Run comprehensive benchmark suite.

Parameters:

max_vars – Maximum number of variables to test

Returns:

Complete benchmark results

print_results(results: dict[str, Any]) None[source]

Print formatted benchmark results.

plot_results(results: dict[str, Any], save_path: str | None = None) None[source]

Plot benchmark results if matplotlib is available.

boofun.benchmarks.run_quick_benchmark() dict[str, Any][source]

Run a quick benchmark for development testing.