[llvm-commits] PATCH: Fix quadratic behavior in PR12652

Chandler Carruth chandlerc at gmail.com
Fri Jul 6 03:54:52 PDT 2012


Sorry, I am not communicating this well tonight... distracted with other
things.

Please ignore the obviously confusing and incorrect statements earlier,
I'll try to explain from scratch.

What I originally observed, very roughly:

compile_time(N*size) < 2 * N * compile_time(size)

I started with 4 test cases: 0.5k, 1k, 2k, 4k in "size"

0.5k compiled in under 1 second
1k compiled in under 2 seconds
2k compiled in under 4 seconds
4k compiled in under 8 seconds

This did not look quadratic to me at first -- the time is a linear product
of the size. And no, this is not at all what my original email stated, my
english skills failed me there.

Alas, in the way of things, these are not very precise measurements, and
there are very many other factors at play. I gathered repeated
measurements, but they're still very noisy.

When I continued to collect more data points further out to better
establish any remaining problems or curves, a new super-linear growth curve
emerged:

8k compiled in around 32 seconds
16k compiled in around 180 seconds
32k compiled in around 1200 seconds (but at this point, my machine started
swapping, so all bets off).

This is what I hinted at in my last mail... The profiles of these much
larger compilations point to very different parts of the code generator, so
they don't likely have anything to do with this patch other than this patch
allowing us to see them. Previously, they didn't dominate the performance.

Hope this reduces confusion some, sorry about all that.
-Chandler




On Fri, Jul 6, 2012 at 3:20 AM, Jay Foad <jay.foad at gmail.com> wrote:

> On 6 July 2012 09:42, Chandler Carruth <chandlerc at gmail.com> wrote:
> > It doesn't grow by the size of the input squared, it grows by a constant
> > factor of the size of the input, the constant happens to be "2" instead
> of
> > "1".
>
> So on input size n, the runtime is 2n. (*)
>
> > Thus if I double the size of the input, I quadruple the runtime.
>
> No. Input size 2n ==> runtime 4n. Both have doubled.
>
> > It
> > isn't quadratic unless when I quadruple the size of the input, it
> multiplies
> > the time by 16 (4*4) -- currently it just multiplies it by 8 (2 * 4).
>
> You're telling me that doubling input size quadruples runtime, but two
> successive doublings don't give two successive quadruplings.
> Seriously?
>
> (*) Obviously the units are arbitrary here, which makes the constant
> factor arbitrary too. This is very basic big-O notation stuff.
>
> Jay.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120706/b457f903/attachment.html>


More information about the llvm-commits mailing list