Go ahead, write the “stupid” code
spikepuppet.io
Go ahead, write the “stupid” code
1–10 of 157 posts
Re: Go ahead, write the “stupid” code
#2Re: Go ahead, write the “stupid” code
#3struct S { int a; int b; int c; int d; int e; /* about 15 more members */ }
so I wrote
const auto match_a = s.a == 10; const auto match_b = s.c == 20; const auto match_c = s.e == 30; /* about 15 more of these */ if (match_a && match_b && match_c) { return -1; }
Turns out compilers (I think because of the language) totally shit the bed at this. It generates a chain of 20 if-else instead of a mask using SIMD or whatever. I KNOW this is possible, so I asked an LLM, it was able to produce said code that uses SIMD.
Re: Go ahead, write the “stupid” code
#4Re: Go ahead, write the “stupid” code
#5https://sebastianhetman.com/why-quantity-matters/
Do stuff, and you learn stuff. Go play.
Re: Go ahead, write the “stupid” code
#6Re: Go ahead, write the “stupid” code
#7Re: Go ahead, write the “stupid” code
#8I appreciate the sentiment, but "There is no stupid code" is the dumbest sentence I've ever read.
Re: Go ahead, write the “stupid” code
#9Re: Go ahead, write the “stupid” code
#10That's why. If all codes in a project are stupid, there's no stupid code indeed relatively.
Go read Linux kernel mailing list.