For monoalphabetic substitutions, I stop at 10000 and automatically restart if the answer is gibberish. For speed, I use C language, and so I can break 3B in a second or two.
For other ciphers, I modified the simulated annealing approach by doing something like this:
if (f > bestfit) or ((f > 1.05*bestfit) and (randrange(100) < 5)):
If the 1.05 is adjusted to be the height of local maxima (compared to the nearest valley), then it doesn’t get stuck.