We all know and love (!) the leaderboard, but how about a different method?

One can solve a problem with a simple, naive method resulting in a short program and long runtime, or put in lots of explicit optimizations for more code and shorter runtime. (Or if you’re really good, a short, fast program!)

I propose the line-second.

Take the number of lines in your program (eg, 42 lines) and the runtime (eg 0.096 seconds). Multiply these together to get a score of 4.032 line-seconds.

A smaller score is a shorter, faster program.

Similarly, (for a particular solver), a larger score is a “harder” problem.

  • hades
    link
    fedilink
    arrow-up
    5
    ·
    11 months ago

    Lines of code can be arbitrarily reduced, and seconds to solve depends to a large extent on how good my hardware is. So both metrics are useless, and multiplying them makes a useless-squared metric.

    I love it!

    Here are my stats for the solutions so far (with no optimisation beyond the initial solution):

    +-----+-----------+-------+---------------+
    | Day | Time (s)  | Lines | line-seconds  |
    +-----+-----------+-------+---------------+
    |  1  |  0.003    |   35  |   0.098       |
    |  2  |  0.001    |   47  |   0.042       |
    |  3  |  0.006    |   60  |   0.348       |
    |  4  |  0.003    |   41  |   0.115       |
    |  5  |  0.077    |   74  |   5.708       |
    |  6  |  0.000    |   45  |   0.001       |
    |  7  |  0.005    |   87  |   0.395       |
    |  8  | 10.175    |   60  | 610.476       |
    |  9  |  0.004    |   31  |   0.128       |
    | 10  |  0.084    |  103  |   8.634       |
    | 11  |  0.240    |   49  |  11.771       |
    | 12  |  2.448    |   93  | 227.633       |
    | 13  |  0.009    |   83  |   0.707       |
    +-----+-----------+-------+---------------+