broot vs brootinv performancs

Torbjorn Granlund tg at gmplib.org
Wed Oct 31 14:29:59 CET 2012


nisse at lysator.liu.se (Niels Möller) writes:

  Can you tell me an easy way to do that? I'm not sure which operands are
  relevant (size, and powers or non-powers), and it seems the speed program
  doesn't know about mp?_perfect_power_p at all.
  
I sometimes write silly little programs when faced with such issues.
Such as (untested):

#include "gmp.h"
#include "gmp-impl.h"
#include "tune/speed.h"
int
main (int argc, char **argv)
{
  mpz_t a;
  int i;
  double t;
  mpz_init_set_str (a, argv[1], 0);
  for (i = 0; i < 20; i++)
    {
      speed_starttime ();
      mpn_perfect_power_p (PTR(a), SIZ(a));
      t = speed_endtime ();
      printf ("%.8f\n", t);
    }
}

-- 
Torbjörn


More information about the gmp-devel mailing list