Algorithm Benchmarker
Mission Brief
Go beyond naive wall-clock stopwatch scripts by building a testable, extensible desktop benchmarking harness capable of adversarial worst-case generation, empirical Big-O curve fitting, JIT warmup isolation, and SQLite run persistence.
Key Systems Engineered
Reflection Auto-Discovery of 51 Algorithms Across 10 Domains (IAlgorithm & AlgorithmRegistry)
Follows the Open-Closed Principle via a single contract (Name, Category, Complexity, Execute(object input)). AlgorithmRegistry scans assemblies via reflection at startup to populate the UI automatically with 51 implementations across Sorting (6), Searching (5), Graph (6), Routing (6), Dynamic Programming (5), Indexing (6), Machine Learning (6), Encryption (5), Compression (5), and Data Structures (1).
10 Research-Grade Profiling & Verification Services (Services/Profiling/)
Includes TheoreticalBoundVerificationEngine (fits R-squared least-squares regressions against candidate Big-O curves), AdversarialEngine (generates pathological worst-case inputs), ExecutionTracer ([ThreadStatic] step counters), AmdahlAnalyzer (synchronized barrier concurrency scaling), CacheLocalityAnalyzer (stride-based cache-miss math), JitWarmupProfiler, GcTopologyProfiler, EnergyEstimator, AlgorithmicPhaseTransitionDetector, and DragRaceOrchestrator.
DI-Backed MVVM Architecture with SQLite Persistence & LiveCharts2
MainViewModel uses Microsoft.Extensions.DependencyInjection (10.0.2) and CommunityToolkit.Mvvm (8.4.0) to orchestrate cancellable async benchmark sweeps (CancellationTokenSource), persisting telemetry to a local SQLite database (Microsoft.Data.Sqlite 10.0.2) and rendering real-time charts via LiveChartsCore.SkiaSharpView.WPF (2.0.0).
Boss Fight: Separating True Algorithmic Complexity from .NET JIT Warmup & GC Noise
Raw wall-clock timings on managed runtimes are heavily distorted by first-call JIT compilation and mid-run garbage collection pauses. Building dedicated JitWarmupProfiler and GcTopologyProfiler passes alongside thread-local operation counters ([ThreadStatic] ExecutionTracer) allowed the TheoreticalBoundVerificationEngine to compute clean R-squared fits against theoretical asymptotic bounds.
Implementation Details
Architecture & Deep Dive
The benchmarker follows a strict MVVM architecture with dependency injection at its core. At startup, AlgorithmRegistry scans loaded assemblies for types implementing IAlgorithm, automatically populating the UI without requiring manual registration.
Profiling Pipeline
Each benchmark sweep runs through multiple profiling passes: JIT warmup isolation (discarding first-run timings), GC topology profiling (forcing collections between runs), and thread-local operation counting via [ThreadStatic] ExecutionTracer fields. This multi-pass approach separates true algorithmic behavior from runtime noise.
Complexity Verification
The TheoreticalBoundVerificationEngine fits measured operation counts against candidate complexity functions (O(1), O(log n), O(n), O(n log n), O(n²), O(2ⁿ)) using least-squares regression, reporting R² scores to empirically verify each algorithm’s theoretical bound.
Execution Modes
Three distinct modes serve different analysis goals: Standard Batch profiles a single algorithm across input sizes, Drag Race runs two algorithms on cloned inputs for direct comparison, and Phase Transition Sweeper detects performance inflection points across input size ranges.
Media Gallery
Loot & Rewards
- 51 verified algorithm files across 10 domains: Sorting (Bubble, Insertion, Selection, Merge, Quick, Heap), Searching (Linear, Binary, Jump, Interpolation, Exponential), Graph (BFS, DFS, Dijkstra, Prim, Kruskal, Topological Sort), Routing (A*, Bellman-Ford, Floyd-Warshall, Distance Vector, Greedy Best-First, Dijkstra Routing), DP (0/1 Knapsack, Memoized Fibonacci, LCS, Coin Change, Matrix Chain), Indexing (BST, B-Tree, Hash Table, Linear Scan, 2x Trie), ML (K-Means, Linear/Logistic Regression, Naive Bayes, Perceptron, Matrix Mul), Encryption (AES, DES, RSA, ChaCha20, SHA-256), and Compression (Huffman, RLE, Deflate, GZip, Brotli).
- Three interactive execution modes: Standard Batch Profiler, Drag Race Mode (concurrent cloned-input comparison), and Phase Transition Sweeper.