Speed golfing also often makes code unreadable and unmaintainable to some degrees. Everything is a trade-off.
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.
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 )