6

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.

you are viewing a single comment's thread
view the rest of the comments
[-] exocortex@discuss.tchncs.de 6 points 2 years ago* (last edited 2 years ago)
  1. I think a more consistent approach would he to not count lines, but filesizes after the code has been minimized with a specific minimizer. I could write everything in one line in many languages, so lines isn't very clever.

  2. The code has to be compiled and run on a specific architecture and with specific test input (we don't know if the AoC-example-data is always the same in size or resulting computanional complexity.

  3. The final metric could be: [minified filesize] * [code execution time] * [problem solving time].

this post was submitted on 13 Dec 2023
6 points (80.0% liked)

Advent Of Code

1248 readers
1 users here now

An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Everybody Codes is another collection of programming puzzles with seasonal events.

EC 2025

AoC 2025

Solution Threads

M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12

Visualisations Megathread

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 3 years ago
MODERATORS