[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msgmerge speedup: fstrcmp and diffseq improvements

From: Paolo Bonzini
Subject: Re: msgmerge speedup: fstrcmp and diffseq improvements
Date: Sun, 21 Sep 2008 10:09:28 +0200
User-agent: Thunderbird (Macintosh/20080707)

> But the compiler does not know that fstrcmp is called millions of time and
> that this piece of code needs to be optimized for speed rather than for space.

If doing profile-directed optimization, it does know.  In this case, it
will even inline five or six recursive calls, as in

  if (n >= 2)
      n1 = n - 1;
      if (n1 >= 2)
          n2 = n1 - 1;
          nn1 = n * n1;
          if (n2 >= 2)
            return nn1 * n2 * fact (n2 - 1);
            return nn1;
        return n;
     return 1;

(which is not the case of fstrcmp, but just to leet you know).

> Does GCC meanwhile have a heuristic that forces inlining of a 'static'
> function that is only used once in the compilation unit?

Yes, though I think it is limited by the growth in stack usage.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]