This is done in the REP section of the affix file (e.g. de_DE.aff).
The main issue is that each replacement pair (phonetic equivalent) has to be added manually to the list.
Hunspell seems fast to me, but it does a lot of processing. It decreases even further in speed, with extra logic added to the aff file, or, as for example, with a very good and extensive wordlists, like the ones that are maintained here for German.
Extra rules, similar to the phonetic replacement lists, are the most time-consuming.
The more you improve, the slower it gets. No way around it. The logic also applies to grammar rules, though.