News for hackers. Stuff that matters.
Re:I wasted weeks hand optimizing assembly because I benchma... by RedNifre on Friday July 25, 2025 @07:49AM (#44682095)
Okay, but how about checking the 99.9% policy first and if it doesn't match, run Ken's solution?
Re:I wasted weeks hand optimizing assembly because I benchma... by fifilura on Friday July 25, 2025 @08:19AM (#44682299)
You'd be better off with some stupid code that junior devs (or Grug brained senior devs) could easily understand for the 0.1% cases.
Re:I wasted weeks hand optimizing assembly because I benchma... by smcin on Friday July 25, 2025 @08:31AM (#44682390)
(In that specific case, with that specific very skewed data distribution, yes. But not necessarily in the general case. So "they" would be better off with that solution, but not a generalized "you").
Re:I wasted weeks hand optimizing assembly because I benchma... by username135 on Friday July 25, 2025 @08:38AM (#44682453)
Then how do they learn
Re:I wasted weeks hand optimizing assembly because I benchma... by mannykannot on Friday July 25, 2025 @10:53AM (#44683849)
My guess is that they would be more likely to “fix” and “improve” Ken’s algorithm than understand it (Jon Bentley mentioned, in passing, a similar case where this was the outcome.)
Re:I wasted weeks hand optimizing assembly because I benchma... by chii on Friday July 25, 2025 @10:33AM (#44683583)
They can learn finite automata from computer science text books.
Re:I wasted weeks hand optimizing assembly because I benchma... by username135 on Sunday July 27, 2025 @08:58AM (#44701017)
True, i suppose, but theres simply no substitute for contextual, on the job learning. imo
Re:I wasted weeks hand optimizing assembly because I benchma... by fifilura on Monday August 04, 2025 @09:10AM (#44785267)
Oh! "Educating the newbies/grunts" is the reason for #$#@&#?

I'd say that an org has a limited number of pennies to spend on non-trivial code. Let's spend them wisely.

Re:I wasted weeks hand optimizing assembly because I benchma... by account42 on Friday August 01, 2025 @01:28PM (#44759733)
That's exactly how you get today's abysmally slow software though, because if you chain enough components you end up running into 1% cases all the time.
Re:I wasted weeks hand optimizing assembly because I benchma... by hinkley on Friday July 25, 2025 @12:30PM (#44685040)
The devil is in the details. A pair of my coworkers spent almost two years working on our page generation to split it onto a static part and a dynamic part. Similar to Amazon’s landing pages. Static skeleton, but lots of lazy loaded blocks. When they finally finished it, the work was mediocre for two reasons. One, they ended up splitting one request into several (but usually two), and they showed average response times dropping 20% but but neglected to show the overall request rate also went up by more than 10%. They changed the denominator. Rookie mistake.

Meanwhile, one of my favorite coworkers smelled a caching opportunity in one of our libraries that we use absolutely everywhere, and I discovered a whole can of worms around it. The call was too expensive which was most of the reason a cache seemed desirable. My team had been practicing Libraries Over Frameworks, and we had been chipping away for years at a NIH framework a few of them and a lot of people who left had created in-house. At some point we lost sight of how we had sped up the “meat“ of workloads at the expense of higher setup time initializing these library functions over, and over, and over again. Example: the logging code depended on the feature toggle code, which depended on a smaller module that depended on a smaller one still. Most modules depended on the logging and the feature toggle modules. Those leaf node modules were being initialized more than fifty times per request.

Three months later I had legitimately cut page load time by 20% by running down bad code patterns. 1/3 of that gain was two dumb mistakes. In one we were reinitializing a third party library once per instantiation instead of once per process.

So on the day they shipped, they claimed 20% response reduction (which was less than the proposal expected to achieve), but a lot of their upside came from avoiding work I’d already made cheaper. They missed that the last of my changes went out in the same release, so their real contribution was 11%, but because of the extra requests it only resulted in a 3% reduction in cluster size, after three man years of work. Versus 20% and 7% respectively for my three months of work spread over five.

Always pay attention to the raw numbers and not just the percentages in benchmarks, kids.

Re:I wasted weeks hand optimizing assembly because I benchma... by TrapLord_Rhodo on Friday July 25, 2025 @12:52PM (#44685296)
That's what he said they did. that's the joke.

>so they changed the existing code to just check that predicate first, and the code sped up a zillion times, much more than with Ken's solution.

but since you've now spent all this time developing some beautiful solution for .01% of the actual data flow. Not the best use of dev time, essentially.

Re:I wasted weeks hand optimizing assembly because I benchma... by RedNifre on Friday August 08, 2025 @08:14AM (#44836102)
Ah, thanks for clarifying. I understood it as "Check that predicate first and if it doesn't match, run the old solution".
Re:I wasted weeks hand optimizing assembly because I benchma... by lispitillo on Friday July 25, 2025 @01:00PM (#44685399)
If a case doesn't match, then speeding up the remaining 0.1% is not going to change much the overall speed. Hence, a non optimized algorithm maybe enough. But when speed and speed variance is critical, then optimization is a must.
Re:I wasted weeks hand optimizing assembly because I benchma... by account42 on Friday August 01, 2025 @01:29PM (#44759746)
The "overall speed" is rarely all that matters.