Hacker News new | ask | show | jobs
by nukanse 6 days ago
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.

2 comments

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.
Top code golf just uses languages where the characters are compressed, and the notation is abused. So the winners read like hfE#^gg
"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.

Now your hourly builds have to redo the expensive calculation in perpetuity.
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.