Significantly improves performance of the tool. Also corrects an mistake in the formula for computing relative errors
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14627