Efficient coding considered harmful?
News administrator
news at rosevax.Rosemount.COM
Fri Nov 4 03:18:32 AEST 1988
[profile of prime calculation]
>%time cumsecs #call ms/call name
> 82.7 4.77 _sqrt
[in code]
> for (i = 2; i <= root(n); i++)
[note: root() calls sqrt()]
sqrt() shouldn't dominate your profile so much after you take it out
of the loop. This isn't fortran; root() is called on every iteration.
True, some optimizations are maintenance pessimizations, but
most C compilers can't tell when function calls can be optimized out.
Thus the call for a "pure function" keyword (a function whose value is
the same for the same arguments, with no side effects).
> Paul Schmidt
Merlyn LeRoy
More information about the Comp.lang.c
mailing list