Author: Semplicementeio
Environment: Go 1.22.2 / Linux x86_64 / AMD Ryzen 5 5500U (6 Cores, 12 Threads)
This paper presents an empirical performance evaluation of the github.com/Semplicementeio/Genetic-Algorithm library. We analyze the scalability of parallel worker-pool fitness evaluations, measure generational throughput across population sizes, evaluate scientific reproducibility under deterministic PRNG seeds, and compare Genetic Algorithm (GA) convergence performance against Simulated Annealing (SA) and Random Search (RS) on non-convex multi-modal landscapes (Rastrigin & Ackley functions). In addition, we evaluate the impact of coarse-grained parallel Island Model optimization across varying island configurations.
To measure the speedup of multi-threaded fitness evaluation, we benchmarked a heavy 50-dimensional optimization task (Ackley function with synthetic workload) across varying worker counts.
| Workers | Execution Time (ns/op) | Throughput Speedup | Allocations / Op | Memory / Op |
|---|---|---|---|---|
| 1 | 5,561,900,811 ns | 1.00x (Base) | 35,390 | 16.28 MB |
| 2 | 2,868,093,249 ns | 1.94x | 35,512 | 17.26 MB |
| 4 | 3,113,030,915 ns | 1.79x | 35,555 | 17.26 MB |
| 8 | 2,148,099,920 ns | 2.58x | 35,641 | 17.27 MB |
| 16 | 1,807,508,746 ns | 3.08x | 35,839 | 17.30 MB |
- Linear Speedup up to 2 Workers: Going from 1 to 2 workers achieved 1.94x speedup (97% parallel efficiency).
- Diminishing Returns (>8 Workers): Beyond physical core count (6 physical cores), thread context switching, channel synchronization overhead, and CPU cache line bouncing prevent linear scaling. The non-parallel portion of the algorithm (selection, crossover, mutation, elitism) imposes an upper bound on speedup per Amdahl's Law.
We evaluated runtime and allocation overhead across varying population sizes (50 generations per run):
| Population Size | Time / Run (ms) | Allocations / Op | Memory / Op |
|---|---|---|---|
| 100 | 4.42 ms | 9,430 | 1.38 MB |
| 500 | 21.38 ms | 45,041 | 6.83 MB |
| 1000 | 47.35 ms | 89,702 | 13.66 MB |
| 5000 | 243.68 ms | 446,681 | 68.27 MB |
Observations show strict
We benchmarked GA against Simulated Annealing (SA) and Random Search (RS) across
| Algorithm | Mean ± StdDev | Best Min Found | Success Rate (<0.1) | Avg Time (ms) |
|---|---|---|---|---|
| GA | 1.8579 ± 1.2776 | 0.000139 | 5/30 (17%) | 6.31 ms |
| SA | 32.6073 ± 12.1240 | 3.979875 | 0/30 (0%) | 1.54 ms |
| RS | 16.0248 ± 2.6549 | 10.113479 | 0/30 (0%) | 1.75 ms |
| Algorithm | Mean ± StdDev | Best Min Found | Success Rate (<0.1) | Avg Time (ms) |
|---|---|---|---|---|
| GA | 0.0028 ± 0.0011 | 0.001100 | 30/30 (100%) | 6.61 ms |
| SA | 5.0892 ± 3.2166 | 0.000328 | 7/30 (23%) | 2.06 ms |
| RS | 3.3152 ± 0.4087 | 2.441415 | 0/30 (0%) | 2.06 ms |
Evaluating the effect of multi-island sub-populations on the Rastrigin 5D multi-modal landscape (
| Architecture | Mean ± StdDev | Best Min Found | Success Rate (<0.1) | Avg Time (ms) |
|---|---|---|---|---|
| Single Population GA (100 pop) | 1.8579 ± 1.2776 | 0.000139 | 5/30 (17%) | 6.05 ms |
| Island GA (4 Islands, 25 pop/island) | 1.3608 ± 1.0738 | 0.000291 | 6/30 (20%) | 3.25 ms |
| Island GA (8 Islands, 12 pop/island) | 1.1932 ± 1.2433 | 0.000466 | 37% (11/30) | 3.56 ms |
- Diversity Preservation: Dividing the global population into independent sub-populations (islands) significantly reduces premature convergence. Success rate on Rastrigin 5D increases from 17% to 37%.
- Exploration Trade-offs: Gradient-based methods (Gradient Descent, L-BFGS) remain generally preferable when the objective is differentiable and problem structure allows efficient gradient computation. For sufficiently small discrete search spaces, exhaustive search may be simpler and faster while guaranteeing the optimum.