On 26/07/12 20:27, David Nadlinger wrote:
GDC probably performs inlining by default on -O2/-O3, just like LDC does.

I was surprised that using -inline alone (without any optimization option) doesn't produce any meaningful improvement. It cuts maybe 1s off the DMD-compiled runtime, but it's not clear to me that actually corresponds to a reliable difference. Perhaps GDC just ignores the -inline flag ... ?

I suppose it's possible that this is code that does not respond well to inlining, although I'd have thought the obvious optimization would be to inline many of the object methods that are only called internally and that are called in a tight loop:

            do {
                  userDivergence(ratings);
                  userReputation(ratings);

                  reputationObjectOld_[] = reputationObject_[];
                  objectReputation(ratings);
                  diff = 0;
                  foreach(size_t o, Reputation rep; reputationObject_) {
                        auto aux = rep - reputationObjectOld_[o];
                        diff += aux*aux;
                  }
                  ++iterations;
            } while (diff > convergence_);

I might tweak it manually so that userDivergence(), userReputation() and objectReputation() are inline, and see if it makes any difference.

Reply via email to