mpq_cmp_z

Torbjörn Granlund tg at gmplib.org
Tue Aug 25 11:43:04 UTC 2015


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  If you pass NULL, you'll not avoid any pesky branch :-D
  
Indeed.

  If you pass a static "1", and do not branch, you will end up allocating
  space and loosing time to multiply NUM(op1) by one...
  
My idea was to have a file-local mpz_struct, which could be checked for
in the helper to suppress *some* of the more expensive operations.  Or
not.

I am less eager to mess up mpq than e.g. mpn for the sake of
performance.  Suppressing all denomonator ops for op2=mpz seem like
overkill, and then we might as well reimplement mpq_cmp_z.  We should
remember that mpq programs will spend almost all time in gcd
computations anyway.  :-)

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list