Question about the performance of the GMP on a specific integer division case

Jeronimo Pellegrini j_p at aleph0.info
Sun Apr 16 15:34:52 CEST 2023


Torbjörn Granlund <tg at gmplib.org> writes:
> I think it is safe to assume that computing A / B for A < B is not a common
> use of GMP.
>
> In general, we tend to avoid checking for particular operand values, and
> instead have general code which handles the majority of cases effficiently.
> There are exceptions to that rule, but optimising for anomaly cases is not
> something we do.

That makes sense, I agree it's not common. As to why I asked -- I was
working on the arithmetic code of a Scheme implementation, and realized
I could optimize those specific cases, but indeed, I have no expectation
that these will be frequently used.

Thank you very much for your quick answer.

Jeronimo


More information about the gmp-discuss mailing list