performance question

Kevin Ryde user42 at
Fri Apr 30 22:35:30 CEST 2004

Nathan Moore <nmoore at> writes:
> What I'm wondering is if calling the function many many
> times (the function creating, initializing, and at the end, clearing
> the mpq_t variables over and over) is stupid in terms of performance
> costs.

If the real work done there is significant, then the overheads won't
be noticable.  Otherwise the guidelines in the efficiency section of
the manual should be followed.

> To reiterate, will a compiler figure out that mpq_init and mpq_clear
> iterated each time the compute_value() function is called is stupid
> and inline the function for me,

As David said, no.  The compiler doesn't have much idea about what gmp
calls are doing, you need to pay attention to that sort of thing

More information about the gmp-discuss mailing list