News for hackers. Stuff that matters.
Re:Ask HN: What was your most humbling learning moment? by eru on Monday June 03, 2024 @04:06AM (#40560352)
'Optimising' for simplicity would often be a good idea, though.

Optimising for speed of execution only matters some times.

Re:Ask HN: What was your most humbling learning moment? by VBprogrammer on Monday June 03, 2024 @05:46AM (#40560942)
Optimising for simplicity first is almost always the right thing to do. Even if it turns out to be too slow you then have a reference implementation to confirm correctness against.

In my experience it's rare to correctly identify the bottleneck in code while writing it.

Re:Ask HN: What was your most humbling learning moment? by eru on Monday June 03, 2024 @08:47AM (#40562141)
Oh, I had situations in mind where I can quickly write a simple version.

But sometimes when I really torture my brain I can spend a few days of doing mathematical proofs etc to come up with a even simpler solution.

That extra effort is only sometimes necessary. (But can be lots of fun to develop.)

Re:Ask HN: What was your most humbling learning moment? by Jensson on Monday June 03, 2024 @11:05AM (#40563339)
> In my experience it's rare to correctly identify the bottleneck in code while writing it.

Why? It is so easy, just think of the work being done and pick the big parts, those are the bottlenecks.

Only reason I can see anyone fail at that is that they don't know how long things take in their programming language, but that takes very little time to learn, and once learned you will know the bottlenecks before writing.

In so many cases the bottleneck is using bad data structures everywhere, that often gets you 100x runtime and doesn't show up in a profiler because it is spread out all over the codebase, that is the real bottleneck that never gets fixed and is why programs are slow today. To fix that you have to learn to know the bottlenecks as you write the program and not rely on a profiler. Profilers helps you find how long things take, they are really bad at helping you understand how to make the program fast.

Re:Ask HN: What was your most humbling learning moment? by bick_nyers on Monday June 03, 2024 @12:01PM (#40564000)
Depends on your definition of simplicity.

Some view simplicity more as minimizing lines of code, e.g., less moving parts.

I view simplicity more as increasing lines of code, the goal being to make the code very verbose. Sometimes this means more moving parts, but smaller "movement" at each step.

There are other views of simplicity as well.

Re:Ask HN: What was your most humbling learning moment? by ayewo on Monday June 03, 2024 @06:42AM (#40561307)
The steps in this witty quote helps puts things in perspective as what anyone should do first when in doubt: "Make it work, make it correct, make it fast".
Re:Ask HN: What was your most humbling learning moment? by eru on Monday June 03, 2024 @08:48AM (#40562150)
And the 'fast' can be optional.

But sometimes you already have something that works, is correct and fast, but you still want to simplify: for example, when understanding _why_ that code is correct is too annoyingly complicated to explain and understand.

Re:Ask HN: What was your most humbling learning moment? by tracker1 on Monday June 03, 2024 @10:21AM (#40562891)
With AMD having 128 core CPUs with a 192 core coming soon... Depending on what you're doing, and how you're doing, there's a LOT of raw horsepower you can throw at a problem. For example, a classic RDBMS (PostgreSQL, MS-SQL, etc) over more complex No/New SQL solutions.
Re:Ask HN: What was your most humbling learning moment? by joseda-hg on Monday June 03, 2024 @09:18AM (#40562343)
It breaks the flow of the quote, but it really should be 'make it fast enough'
Re:Ask HN: What was your most humbling learning moment? by jorvi on Monday June 03, 2024 @02:14PM (#40565539)
I deeply hate this modern attitude.

It’s factually correct due to hardware and compilers (néé transpilers) offering so much headroom, but part of me cries when you compare modern hardware utilization compared to how optimized-to-the-gills late generation PS2 games were.

Re:Ask HN: What was your most humbling learning moment? by WhyCause on Monday June 03, 2024 @03:40PM (#40566679)
I would argue that the fast part isn't optional for web apps (where "transpiling"), but it can be in many other instances.

I write a lot of data-pipeline code in Python that mostly runs once a day. Does it matter if it takes an hour to run instead of five minutes? Not really, as long as it's ready to go for the next run.