GMP's Speed

Chris Osborne chris.osborne at
Fri Mar 9 11:05:50 CET 2012

>Marc Glisse <marc.glisse at callgate- > writes: > > Of course gmp is much slower than builtin types. And it is slower by a > factor larger than the 2-3 you mention. There must be something > missing in your email, because I don't understand how you can expect > gmp to be as fast as double... > >Java might explain some of that. I think it is still considerably >slower than compiled languages for number crunching tasks. > >-- >Torbjörn 

 That's exactly what I was expecting due to java being an interpreted language, It had been suggested to me that c++ was around 10 times faster for most operations, but this was without taking into account external libraries.

 All of my numbers are in the class mpz and I am only using mpz functions with them (so precision is not counted). As I use very few functions, i could possibly just extract the source code for the functions I need from gmplib and compile tem directly inside my program. Would I stand to gain anything from this?

 Thanks for these insightful responses, and the suggestion of openmp,

More information about the gmp-discuss mailing list