Relative Content

Tag Archive for c++optimizationprofilingarbitrary-precision

A faster way of comparing arrays of integers lexicographically

I’m currently writing an arbitrary precision library for fun (yes, I know that GMP exists) and I’m using it to generate large prime numbers (~5000 digits) with the Miller-Rabin primality test. I profiled the code and noticed that around 30 percent of the time was spend comparing two numbers as part of the modulo operation. This is what that part of the code looks like: