2.6 Performance optimization

For optimal performance, build GMP for the exact CPU type of the target computer, see Build Options.

Unlike what is the case for most other programs, the compiler typically doesn’t matter much, since GMP uses assembly language for the most critical operation.

In particular for long-running GMP applications, and applications demanding extremely large numbers, building and running the tuneup program in the tune subdirectory can be important. For example,

cd tune
make tuneup
./tuneup

will generate better contents for the gmp-mparam.h parameter file.

To use the results, put the output in the file indicated in the ‘Parameters for ...’ header. Then recompile from scratch.

The tuneup program takes one useful parameter, ‘-f NNN’, which instructs the program how long to check FFT multiply parameters. If you’re going to use GMP for extremely large numbers, you may want to run tuneup with a large NNN value.