this post was submitted on 16 Jul 2023
1163 points (98.4% liked)

Programmer Humor

32371 readers
425 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] CanadaPlus@lemmy.sdf.org 14 points 1 year ago* (last edited 1 year ago) (1 children)

Writing the code in a natural and readable way should be number one.

I mean, even there it depends what you're doing. A small matrix multiplication library should be fast even if it makes the code uglier. For most coders you're right, though.

[–] Dohnakun@lemmy.fmhy.ml 6 points 1 year ago* (last edited 1 year ago) (1 children)

Even then you can take some effort to make it easier to parse for humans.

[–] CanadaPlus@lemmy.sdf.org 4 points 1 year ago (1 children)

Oh, absolutely. It's just the second most important thing.

[–] Aceticon@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

You can add tons of explanatory comments with zero performance cost.

Also in programming in general (so, outside stuff like being a Quant) the fraction of the code made which has high performance as the top priority is miniscule (and I say this having actually designed high-performance software systems for a living) - as explained earlier by @ForegoneConclusion, you don't optimize upfront, you optimized when you figure out it's actually needed.

Thinking about it, if you're designing your own small matrix multiplication library (i.e. reinventing the wheel) you're probably failing at a software design level: as long as the licensing is compatible, it's usually better to get something that already exists, is performance oriented and has been in use for decades than making your own (almost certainly inferior and with fresh new bugs) thing.

PS: Not a personal critical - I too still have to remind myself at times to not just reinvent that which is already there. It's only natural for programmers to trust their own skills above whatever random people did some library and to want to program rather than spend time evaluating what's out there.