7 ms·
This is why I come to HN, I was going to skip this because I thought it was about video games, but really glad to have read it, and loved every line of the art
by segmondy 6y ago
This is why I come to HN, I was going to skip this because I thought it was about video games, but really glad to have read it, and loved every line of the article.
So much to get from this.
Even if you don't have the source, you can make a change if you are annoyed enough.
If you don't like something, and the source code is out there, really go contribute.
Performance matters, know how to profile and if using an external dependency, then figure out their implementation details.
Algorithms & Data structures matter, often I see devs talking about how it doesn't matter much but the difference between using a hashmap vs array is evident.
Attentive code reviews matter, chances are they gave this to a junior dev/intern, and it worked with a small dataset and no one noticed.
- bluedino 6y agoI always tell a story about an application we ran, it generated its own interface based on whatever was in inventory. Someone did something really stupid and duplicated each inventory item for each main unit we sold...so you had recursive mess. Assigning 100,000 items when previously it was 100-ish Anyway, everyone just rolled their eyes and blamed the fact that the app was written in Java. It ended up generating an XML file during that minute long startup....so we just saved the file to the network and loaded it on startup. If inventory changed, we’d re-generate the file once and be done with it.
- indeedmug 6y agoIt's a lot easier to blame an language for being slow because it's obvious. Blaming algorithms requiresputying in the time to figure things out.
- acdha 6y agoThere’s also a confound between a language and its communities. I’ve seen so many cases where a “slow” language like Python or (older) Perl smoked Java or C++ because the latter developers were trying to follow cultural norms which said that Real Decelopers™ don’t write simple code and they had huge memory churn with dense object hierarchies and indirection so performance ended up being limited by O(n) XML property lookups for a config setting which nobody had ever changed whereas the “slow” language developer had just implemented a simple algorithm directly and most of the runtime was in highly-optimized stdlib native code, a fast regex instead of a naive textbook parser which devolved into an object churn benchmark, etc. Languages like Java get a lot of bad reputation for that because of popularity: not just that many people are hired into broken-by-design environments (or ones where they’re using some framework from a big consultancy or a vendor who makes most of their revenue from consulting services) but also because many people learn the language as their first language and often are deeply influenced by framework code without realizing the difference between widely used long-term reusable code and what most projects actually need and are staffed for. It’s easy to see the style of the Java standard frameworks or one of the major Apache projects and think that everyone is supposed to write code like that, forgetting that they have to support a greater number of far more diverse projects over a longer timeframe than your in-house business app nobody else works on. Broader experience helps moderate this but many places choose poor metrics and neglect career development.
- closeparen 6y ago> devolved into an object churn benchmark I'm stealing this phrase.
- imtringued 6y agoJava is RAM guzzler with some a small inability to optimize with value types. In its class (managed programming language without value types) it is pretty much as fast as it gets. The two performance flaws that exist are: 1. Old Java frameworks were not written with performance in mind 2. Your entire app is written in Java so you don't benefit from C++ libraries
- closeparen 6y agoI think this is a perfect example of “algorithms and data structures emphasis is overblown.” Real world performance problems don’t look like LeetCode Hard, they look like doing obviously stupid, wasteful work in tight loops.
- nikanj 6y agoAnd trying to optimize them gets you stink eye at code review time. Someone quotes Knuth, they replace your fast 200 lines with slow-as-molasses 10 lines and head to the bar.
- gridspy 6y agoUnfortunately this. Or they will say "don't optimize it until it proves to be slow in production" - at which point it is too dangerous to change it.
- johnfn 6y agoExactly - though to add a little nuance to your post, it’s about having a million loops in a 10M line code base and exactly one of them is operating maximally slowly. So preventing the loop from entering the code base is tough - finding it is key.
- segmondy 6y agoleetcode style thinking will allow you to spot obviously stupid wasteful work in tight loops.
- rictic 6y agoTrue that it's rare that you need to pull out obscure algorithms or data structures, but in many projects you'll be _constantly_ constructing, composing, and walking data structures, and it only takes one or two places that are accidentally quadratic to make something that should take milliseconds take minutes. The mindset of constantly considering the big-O category of the code you're writing and reviewing pays off big. And neglecting it costs big as well.
- 6y ago
- madeofpalk 6y ago> Even if you don't have the source, you can make a change if you are annoyed enough. Well, until you get flagged by the anti cheat and get your account and motherboard banned...
- zionic 6y agoImagine getting banned for fixing their insane load times lol
- rocqua 6y agoGetting banned for DLL injection seems very likely to me. It certainly is a risk. Heck, it might be against the EULA, which probably doesn't hold op legally, but is decent grounds for a ban.
- madeofpalk 6y agoGetting banned for modifying the game process seems very commonplace and likely? It'll be a part of any anti-cheat system, it's basically table stakes.
- fctorial 6y agoThis was probably a compiler bug. I don't think the programmers coding the business logic were using 'strlen' and 'sscanf' directly.