Optimized performance of the GCD algorithm