title: Benchmarks in Apache Celix

Benchmarks in Apache Celix

This document describes how to build and run benchmarks for Apache Celix.

Building Benchmarks

Benchmarks can be built using the CMake option ENABLE_BENCHMARKING The Apache Celix benchmarks uses Google benchmark library.

To build benchmarks run:

cmake -B build -DENABLE_BENCHMARKING=ON
cmake --build build

Benchmarks

The following benchmark executables are available after building the utils and framework benchmarks:

Utils Benchmarks:

  • build/libs/utils/benchmark/celix_filter_benchmark
  • build/libs/utils/benchmark/celix_long_hashmap_benchmark
  • build/libs/utils/benchmark/celix_string_hashmap_benchmark
  • build/libs/utils/benchmark/celix_utils_benchmark

Framework Benchmarks:

  • build/libs/framework/benchmark/celix_framework_benchmark

Paths may vary depending on your configuration and enabled options.

Running Benchmarks

Benchmark executables are located in the build directory, typically under the relevant bundle or library subdirectory. To run a benchmark:

./build/libs/utils/benchmarks/celix_utils_benchmark
## Command-Line Options
The benchmark executables accept standard Google Benchmark command-line options. 
For example, to run only benchmarks matching a specific pattern and output results in JSON format:

```bash
./build/libs/utils/benchmark/celix_filter_benchmark --benchmark_filter=complexFilter --benchmark_format=json

Replace celix_utils_benchmark and the filter pattern as needed. To see a list of supported command-line flags, run the benchmark executable with the --help option:

./build/libs/utils/benchmarks/./celix_filter_benchmark --help

This will display all available Google Benchmark options.