Const Function Parameters?
wine at troy.rollo.name
Tue Jul 26 19:21:09 CDT 2005
On Wed, 27 Jul 2005 09:25, Felix Nawothnig wrote:
> There is no need to make anything except the pointers const - I don't
> think I've ever seen that in real world code. In theory this would give
> the compiler slightly more information... but if the optimizer is unable
> to figure out that the parameter is never used as an lvalue by himself
> it sucks so badly that it probably won't do much better with that hints
> anyway. :-)
In fact I don't know that making these const would make any difference - I'd
like to see the assembly code generated by the two versions for comparison.
> Constifying the pointers is fine ofcourse (but rather because it helps
> finding bugs than for those 1.5% performance improvements.
The 1.5% appears to be within the noise.
A few of us analysed those routines to death on IRC a couple of months back
and decided the real problem was that they were being called too frequently,
not that there was a problem with the routines themselves. The routines could
probably be made faster by rewriting them in assembly language, but bigger
benefits could be gained by figuring out why there are so many calls and
reducing the number of calls.
More information about the wine-devel