[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why do people on /g/ often forget these rules?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 27
Thread images: 3

File: code_rule.jpg (275KB, 1098x1220px) Image search: [Google]
code_rule.jpg
275KB, 1098x1220px
Why do people on /g/ often forget these rules?
>>
>>59988958
need to optimize fizzbuzz for mission critical performance
>>
did you write this yourself lol
>>
one of my professors wrote code during the 60s for the moon landing. even to this day, all of his variables are one or two letters, so are his functions, etc. it's so fucking awful to read it.
>>
Because people on /g/ almost surely do NOT work as programmers. (web-macaques are not programmers and you know that)
>>
>>59988958
wtf does rule 1 even mean ? those things aren't even related. you can optimize performance with all kinds of hacks and still make readable
>>
>>59988958
Readability and performance are literally never mutually exclusive as long as you write half decent comments.
>>59991023
This
>>
File: programmer_employability.png (27KB, 520x544px) Image search: [Google]
programmer_employability.png
27KB, 520x544px
>>59988998
Yeah, but I'm qualified to. Here's another one
>>
>>59991023
Here's an example since you're obviously too retarded to grasp the obvious: not using xor swap on ints when regular swap is enough.
>>
>Never compromise code readability for optimization
Do you know what a fucking comment is for?
>>
>>59991047
>sum of all primes below two million
Why does anybody think memorizing a sieve is impressive?
>>
>>59991072
/* prematurely-optimized division by 16 because I'm too stupid not to know it's done by the compiler even with -O0 */
unsigned int fag = op & 0xF;
>>
>>59991097
>All code optimizations are done by the compiler
I'm not saying reduce your entire codebase to bitshifts like some tryhard faggot, but if you optimize your code into some confusing blob of shit that you'd have to have written or study for an hour to understand, just write a fucking comment
>>
>>59991052
you do know that xor swaps perform way worse than swaps with a temporary variable or if your cpu supports it, it's own swap instruction ?
you couldn't have given a more retarded example
>>
>>59991108
I didn't say "all code is optimized", that particular statement can be written as
fag = op / 16;
and would still be optimized to a bitwise AND.

I've seen some shit that not even the most detailed comments can explain and pretty much must be rewritten.
>>
>>59991140
>xor swaps perform way worse than swaps with a temporary variable
Show me the assembly with -O0 and -O3. No internal instruction allowed.
>>
>>59991163
you can't do it yourself ? i'll help you: it's gcc -S
>>
>>59991090
>memorizing
It's not. You're supposed to know how a sieve works and be able to implement it. The concept of a basic sieve is simple: you mark off multiples of consecutive primes, e.g. all composites. If you can't work up from there, you're worthless. And you don't actually need a sieve, since 2 million is still a small number to brute force via trial division provided you implement trivial optimizations (e.g. don't bother checking even numbers), and so those that fumble while regurgitation a sieve and give up instead of moving on to simple trail division are outed as incompetent code monkeys.
>>
>>59991090
Doing two billion atleast shows you probably know how pointers work. 2 million is pretty much pointless.
>>
>>59991195
Burden of proof is on you, faggot.
>>
>>59991206
3x xor > 1x xchg
i hope you have enough working braincells to get it now.
>>
>>59991256
I said no xchg instruction, cuck.
>>
>>59991199
> pretty much pointless
Kek
You made a joke
>>
File: 1484342982121.png (279KB, 406x382px) Image search: [Google]
1484342982121.png
279KB, 406x382px
>>59988958
>image
literally java programmers
>>
They never knew them in the first place.
The number of people on /g/ who have worked to hone their art is pretty small.
>>
>>59991319
no you didn't. and swaps using a temporary variable get optimized to xchg by the compiler.
>>
>>59991350
Oh shit I did.
Thread posts: 27
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.