A question about mpz_out_str and mpz_out_raw output limitation

Torbjörn Granlund tg at gmplib.org
Mon Jun 30 09:55:02 UTC 2014


David Gillies <daggillies at gmail.com> writes:

  One issue I see is that even mpz_export needs a temporary the same size as
  the mpz_t to be exported, whether allocated beforehand or via the GMP
  allocator if rop is NULL. It would be nice if there were API calls to
  serialise (and deserialise) directly to/from a FILE* without memory
  allocation overhead. Or are there reasons why this is a daft idea?
  
I am sure that would be doable, but I am less sure it would improve GMP
a lot.

The speedup would be limited, since this is a time O(n) function.

The memory save would be limited as 2n memory use is among the smalles
among GM functions; surely you just used more scratch space in order to
generate the result to be printed!


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list