_mp_alloc vs ALLOC

Niels Möller nisse at lysator.liu.se
Sat Jun 2 18:32:49 CEST 2012


Torbjorn Granlund <tg at gmplib.org> writes:

> I thought avoiding the copying was a good idea, but this thread has made
> me less sure.  I suppose it will speed things up only for sizes > some
> threshold, else slow things down.

I guess some benchmarks are needed here.

> It is a shame that C provides such primitive allocation functions.  I'd
> like a realloc with extend-at-the-end, extend-at-the-beginning, and with
> an optional call-back copying function.

What do you think the chances are of getting something like that into
glibc?

> I agree the current gmp realloc interface is broken, in particular in
> the light that we don't adhere to it ourselves.  We could make a
> documentation change where we say that the oldsize argument will be the
> allocated size of it is known, else 0...

I think "Obsolete, always zero" would be less confusing than "sometimes
zero".

> But perhaps we should build a list of incompatible things to fix,
> small and large, and at some point decide change them all? We could
> make a subpage to the GMP devel web pages, "Things the developers
> think are broken in GMP" with this list.

I think that's a good idea. And I guess it might need a special section
about "things some (but not all) developers think are broken"...

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list