Benchmarking and Profiling Genetic Algorithms
Explore benchmarking and profiling techniques to analyze the performance of genetic algorithms in Elixir. Understand how to identify bottlenecks, decide when to optimize, and apply steps like parallelization and NIFs to improve efficiency with large data sets.
We'll cover the following...
Exploring BEAM
Thus far, we haven’t needed to worry too much about the performance of the algorithms we’ve implemented. The solutions have been small, and we’ve been working with relatively small populations. Because of this, we haven’t needed to be concerned with efficiency. In the real world, however, we’ll often need to deal with significantly larger solutions and populations when applying genetic algorithms to practical problems.
As it turns out, Elixir is a language that wasn’t designed to be extremely efficient at computationally expensive tasks. Things like floating-point, math, and matrix multiplication are slow in Elixir. This is because Elixir runs on the BEAM, which was designed for telecommunication systems. This doesn’t mean we can’t write efficient genetic algorithms in Elixir; it means we need to be deliberate in optimizing those algorithms. ...