License
BSD-3-Clause
Performance benchmarking and profiling utilities.
This module provides tools for measuring execution time, memory usage, and comparing performance across different implementations. It is designed to help optimize the Monaco library for maximum performance.
Represents a single benchmark measurement.
string nameName of the benchmarkDuration meanTimeMean execution timeDuration stdevTimeStandard deviation of execution timesDuration minTimeMinimum execution timeDuration maxTimeMaximum execution timeuint iterationsNumber of iterationsDuration totalTimeTotal time for all iterationsdouble opsPerSecondOperations per secondulong memoryUsedMemory allocated (if available)Statistics from multiple benchmark runs.
BenchmarkResult[] resultsIndividual benchmark resultsSysTime timestampTimestamp when benchmarks were runDuration totalDurationTotal duration of all benchmarksstring systemInfoSystem information when benchmarks were runConfiguration for benchmark execution.
uint warmupIterationsNumber of warm-up iterations (default: 3)uint measurementIterationsNumber of measurement iterations (default: 10)Duration minIterationTimeMinimum duration for each iteration (default: 1ms)Duration maxIterationTimeMaximum duration for each iteration (default: 10s)bool collectMemoryWhether to collect memory statisticsbool verboseWhether to print progress informationException thrown when benchmark operations fail.
this(string msg, string file = __FILE__, size_t line = __LINE__)High-precision benchmark runner.
This class provides utilities for measuring the performance of functions with statistical analysis and warm-up phases.
Example:
auto bench = new BenchmarkRunner();
auto result = bench.benchmark!("cpuStats", &cpuStats);
writeln(result);BenchmarkResult benchmark(string name, void delegate() @safe func) @safeBenchmarks a function with automatic warm-up and measurement.Tuple!(T, "value", BenchmarkResult, "stats") benchmarkWithResult(T)(string name, T delegate() @safe func) @safeBenchmarks a function that returns a value.BenchmarkStats runSuite(Tuple!(string, void delegate() @safe)[] benchmarks) @safeRuns multiple benchmarks and returns combined statistics.this()Creates a new benchmark runner with default configuration.this(BenchmarkConfig cfg)Creates a new benchmark runner with custom configuration.Memory profiler for tracking allocations.
This class provides utilities for measuring memory usage during benchmark runs.
private size_t allocatedprivate size_t freedprivate size_t peakstring compareBenchmarks(BenchmarkResult baseline, BenchmarkResult current) @safeCompares two benchmark results.