• Re: Compiler speed testing

    From Tom Lake@tlake@twcny.rr.com to comp.lang.misc on Thu Nov 24 06:34:16 2022
    From Newsgroup: comp.lang.misc

    On Saturday, November 5, 2022 at 11:03:47 AM UTC-4, James Harris wrote:
    Any thoughts on what would be in a good piece of source code to use to
    test a compiler's speed?

    I guess I could do with something that's (1) realistic, not just an assignment statement repeated over and over again, (2) large enough to
    give lengthy timings, (3) easy enough to make, and (4) it would be valid over multiple generations of the compiler. But what should be in it?

    Here are some comparative timings taken just now. They read and compile
    my parser (as it's the largest source file in the compiler). It is about
    18k in size and from it the compiler produces am asm file of a little
    over 100k.

    cda 566 ms
    cdb 540 ms
    cdc 600 ms
    cdd 24 ms

    The reason for the gratifying jump in performance at the end is that I
    added input and output buffering to cdd but it's got me wondering about testing the times taken by future compilers.

    I should say that I don't expect compile times always to improve. The
    run times of later compilers would likely go up as I add facilities and
    down as I switch to other mechanisms. But it would still be something
    I'd like to keep an eye on.


    --
    James Harris
    So you don't care about how fast the generated code runs, instead focusing on how fast the program compiles?
    That seems irrelevant to me since you're going to compile only once or a few times to debug it but run the program many times (if it's useful)
    --- Synchronet 3.19c-Linux NewsLink 1.113
  • From Bart@bc@freeuk.com to comp.lang.misc on Thu Nov 24 14:53:13 2022
    From Newsgroup: comp.lang.misc

    On 24/11/2022 14:34, Tom Lake wrote:
    On Saturday, November 5, 2022 at 11:03:47 AM UTC-4, James Harris wrote:
    Any thoughts on what would be in a good piece of source code to use to
    test a compiler's speed?

    I guess I could do with something that's (1) realistic, not just an
    assignment statement repeated over and over again, (2) large enough to
    give lengthy timings, (3) easy enough to make, and (4) it would be valid
    over multiple generations of the compiler. But what should be in it?

    Here are some comparative timings taken just now. They read and compile
    my parser (as it's the largest source file in the compiler). It is about
    18k in size and from it the compiler produces am asm file of a little
    over 100k.

    cda 566 ms
    cdb 540 ms
    cdc 600 ms
    cdd 24 ms

    The reason for the gratifying jump in performance at the end is that I
    added input and output buffering to cdd but it's got me wondering about
    testing the times taken by future compilers.

    I should say that I don't expect compile times always to improve. The
    run times of later compilers would likely go up as I add facilities and
    down as I switch to other mechanisms. But it would still be something
    I'd like to keep an eye on.


    So you don't care about how fast the generated code runs, instead focusing on how fast the program compiles?
    That seems irrelevant to me since you're going to compile only once or a few times to debug it but run the program many times (if it's useful)

    I can run my compiler hundreds of times a day so fast edit-run cycles
    are vital during intensive development (and I am very impatient, nor do
    I like to lose concentration).

    The speed of the generated code is actually less important: for my
    stuff, unoptimised code might only be half the speed of optimised, but
    during development is largely irrelevant anyway. For production versions
    of working programs, there are ways to get those faster if necessary.

    However, compilation speed can easily vary by 100:1 between fast and
    slow compilers (on one test, but for diverse languages, I estimated
    80,000:1). So, yes, a slow compiler could do with speeding up.

    Complicated languages can hinder that, but I believe the language here,
    like mine, is straightforward to compile.

    As a matter of interest, how long do you typically wait on build-time
    for a project? (And for what sort of line-count.) How long if
    incremental compilation tricks are taken out of play, and a full build
    is needed?
    --- Synchronet 3.19c-Linux NewsLink 1.113