upvote
Very first (and last) coding competition I entered was in ~1991. It was on a local BBS and the challenge was to find all primes from 0-1000. Four scoring metrics were correctness, code size, size of executable and speed of solving.

I took that opportunity to learn a bit of assembly. I’m guessing it was 100 lines of code, COM size was ~100 bytes and it could do the whole test in less than 100ms. I got second place to a turbo pascal entry that had a much larger binary, took 5-10 seconds but it was maybe ten lines of very readable code.

Made me realize that folks really value readability (and to ask how metrics are weighted )

reply
Kind of funny how Zach Barth, while designing engineering games, noticed this distinction between speed, size and time and just made each of the three separate leaderboards in all of his games. But actual serious engineers making "more" serious playthings seemingly couldn't figure it out.

e: Autocorrect did the worst thing you could do to Barth's name.

reply
But it's justified. Efficiency on key parts of the code, of course. Not on the entire code base.

You can mitigate the unreadability in many ways. For example c++ allows to generate magic numbers using constexpress, where the code itself is clear and human readable.

You can create a loop to calculate a lookup table and store it into a small number of uint64. The code shows what the magic numbers mean, and can be debugged.

reply
The reduction of code size in general is called an abstraction. So it is also justified as long as it is not taken to the extreme.
reply
Top code golf just uses languages where the characters are compressed, and the notation is abused. So the winners read like hfE#^gg
reply
"Winners" depends on the where you're competing. Many places include langauge-specific leaderboards, so your Python is not competeing against my GolfScript.

Incidentally, in my experience, the strongest human competition usually is in Python.

reply
Now your hourly builds have to redo the expensive calculation in perpetuity.
reply
The alternative is doing it even more often on production servers or your users old laptop.

Always do as much as possible at compile time, unless it bloats your binary size or makes things slower with cache misses.

reply