Hacker News new | ask | show | jobs
by jonathanlydall 28 days ago
This sounds like being completely performance oblivious, like an extreme opposite of premature optimisation.

My rule of thumb is that as long as it doesn’t really complicate or convolute the code, write with performance in mind.

My expertise is in C# and sometimes this is as simple as using a hash set or dictionary instead of a plain list.

Other times it’s having a decent understanding of how EF (an ORM) actually works (the static typing benefits of them in C# makes ORMs very valuable when used appropriately) and the cost of round trips to any network host (including a DB).

2 comments

"Premature optimization" became a battle cry of the Don't Make Me Think crowd.

As I think back to the people who fought me, the same group didn't like when you refactored code either because now they didn't have the code memorized. But I've found in the intervening years that making code discoverable is much more useful than trying to keep it static because coworkers are always going to need to change shit anyway to implement new features even if that feature is neither Correctness nor Performance. What you don't want is for people to hide logic from you. So if you move logic to a function call, that's fine, because it's still in the same neighborhood. But if you hoist it all the way up into a much earlier part of the call tree, you need to announce that in meetings and maybe in the documentation so people know what's what.

a hashset was used... then ".Where(x=>x == key).Count() == 0"