On 27/04/12 19:23, Jonathan M Davis wrote:
Thanks to the fact that const is transitive and that it's illegal to cast it away to use mutation, const _can_ affect code optimizations, but I don't know exactly under what circumstances it does in the current compiler.
I should add that I'm using GDC 4.6.3 here, not DMD. I just checked with the latter and don't see any speed difference with const/non-const. But the DMD compiled code runs about 20s slower in total anyway, so ... ;-)
Still, like you, if anything, I'd expect const to be faster rather than slower if there's any speed difference. So, what's happening is a bit weird, and I have no idea what's going on.
Yup. :-\