GMP compared to JAVA

Torbjorn Granlund tg at swox.com
Sat Dec 22 18:05:10 CET 2007


  The architecture of the my computer is 3,06GHz, 512MB with GCC.
  The algorithms aren't exactly, but they do the same operation. For
  each loop, the auxiliar variables (exp in C and aux in JAVA) are
  multiplying to 2^10 (1024), the difference is that exp is calculate in
  a loop, and aux is multiplying directly for 1024.
  But the time that I want to calculate is the same for both:
               ini = clock();
               mpz_powm (x, op1,  op2, mod);
               fim = clock();
               temp = fim - ini;

         long tempoInicial = Calendar.getInstance().getTimeInMillis();
         BigInteger calculo = p.modPow(q, m);
         long tempoFinal = Calendar.getInstance().getTimeInMillis();
         return tempoFinal - tempoInicial;

  Can I optimizing GMP for this will be same JAVA?

There is no way one can perform a general modexp at the times you
indicate for java (with any published algorithms).

You're either not generating operands of the same sizes, or you're
generating special operands that the java implementation can "cheat"
with.

PS. Please don't quote full letters to our mailing lists.  Just cut
out the relevant parts, if you wish to quote anything.

-- 
Torbjörn


More information about the gmp-discuss mailing list