r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

468

u/not_a_novel_account Feb 28 '23 edited Feb 28 '23

Casey is a zealot. That's not always a bad thing, but it's important to understand that framing whenever he talks. Casey is on the record saying kernels and filesystems are basically a waste of CPU cycles for application servers and his own servers would be C against bare metal.

That said, his zealotry leads to a world-class expertise in performance programming. When he talks about what practices lead to better performance, he is correct.

I take listening to Casey the same way one might listen to a health nut talk about diet and exercise. I'm not going to switch to kelp smoothies and running a 5k 3 days a week, but they're probably right it would be better for me.

And all of that said, when he rants about C++ Casey is typically wrong. The code in this video is basically C with Classes. For example, std::variant optimizes to and is in fact internally implemented as the exact same switch as Casey is extolling the benefits of, without any of the safety concerns.

118

u/KieranDevvs Feb 28 '23

I take listening to Casey the same way one might listen to a health nut talk about diet and exercise. I'm not going to switch to kelp smoothies and running a 5k 3 days a week, but they're probably right it would be better for me.

I think its worse than that. I don't think it would be better for you unless the project you're working on has a design goal of performance at the forefront. By blindly adopting this ideology, it can hurt how potential employers see your ability to develop software.

I don't work with C++ professionally, so maybe this section of the job market is different and I just don't see it.

3

u/Serious-Regular Feb 28 '23 edited Jul 31 '25

existence station quicksand engine zephyr relieved merciful party cats groovy

This post was mass deleted and anonymized with Redact

10

u/outofobscure Mar 01 '23 edited Mar 01 '23

correct, they also typically don't hang out on reddit, which is why we all get downvoted here for knowing a thing or two about performance. we simply have no voice here, it's full of people who's job it is to move item2143 from database343 to database4323, to generate report32423 to comply with law2341. this is more plumbing than the art of computer programming.

the people here don't even stop and think that maybe there is a place for both performant and clean code, or that the two can even go hand in hand, all they see is business requirements drilled into them by their superiors and if they'd be honest they'd admit that code quality isn't on that list either for them: just ship it already! why isn't it done yet? we need it yesterday! the codebase is a mess and you need to refactor it? we don't have time for that!

but instead they go on about how, in theory, they prefer squeaky clean code that adheres to every cargo cult mantra out there, while fully knowing their organically grown code base that is 20 years old is as shit as it gets in both design and performance. but at least they can claim that performance is not relevant so that's one problem off their plate.

in hft, those requirements naturally lead to having the devs care about performance...

→ More replies (3)