Загрузка видео...
Не удалось загрузить видео
Couldn't agree more with Linus here. Making your code running as fast as possible (or just faster than someone's else code) is the best feeling you can get from programming The issue that it is extremely hard to find the project that will pay you for instruction level efficiency
417,175 просмотров • 1 год назад •via X (Twitter)
Комментарии: 43

He’s absolutely right, this is probably my favorite part about coding. Here’s something I use all the time, I just did a quick example. I’m on my iPhone, so I just pulled a quick example from GPT to show a simple example of autism in this regard. Apples-to-apples example that reliably speeds up: apply a gain and bias to a big float buffer and clamp to [0,1]. That’s math-heavy enough to benefit from SIMD and uses only primitive buffers (so ARC overhead doesn’t get in the way). It’s a lot of fun. This is just simple objective-C in iOS.

That’s right

Optimization offers deep satisfaction, but maintainability is often a more valuable skill. Faster code isn't always better code.

Maintability is a myth. Show me any of the code you write and I will seriously say this is unmaintable piece of shit - I need 2 month to rewrite it. And I will be right. Speed is measurable. Faster code is always better.

@codewithimanshu And yet some code is less unmaintainable than other

@codewithimanshu Let me guess: the code you write is so much more maintainable than the code written by other people?

@mr_alega @codewithimanshu "the size of change required to implement a feature" isn't measurable? you can't count the lines of code changed in a PR? Or count the days it took to get it done? Or the quantity/duration of outages from things breaking?

I can count. And I deliberately saying that it is worth to trash away any code you write because my code I will write instead of yours 1. Will have less lines of code changed in the next prs 2. Will take less days to get anything done 3. Will take less time to debug and fix the outage And the funnies part this is going to be true. I hope you get the point

Only finance can pay for this level efficiency, or military I think. Even IA is shit level efficiency.

I doubt very much that finance that runs the world in Java is interested in paying the money. For corporates like jane street correctness will be always > perf

The essential problem is that as efficiency goes up; extensibility usually goes down.

I always love solving problems in a neat and succinct way. Like a DP solution to something that would otherwise be a nightmare.

In times past, I would write code that was tight, fast, and with as few dependencies as possible. I wish those skills had some value these days. Maybe somewhere in the embedded space they do.

A micro-optimization of any program with many millions of copies running globally isn't a micro-optimization at all

Once organised a speed coding challenge at work: Space Research Organisation Netherlands. A university intern and I competed. Goal was to combine adjacent pixels in an X-ray camera image. In C of course. For over a week every morning we compared results. Crazy how much speed can be improved if you focus on it. We had completely different algorithms: I fiddled linked lists and had a custom memory pool: a linked list that was constructed at compile time (as one of the crazy optimisations). My contender used a more traditional approach with arrays. We ended very close; both thought the other guy had won.

Gaming, HFT, exchanges, sell side trading

Several such open source opportunities available on @solana

Based and @FFmpeg pilled.

"I sometimes think we ought to hang one over every programmer's desk (or around their neck) so they know what they're throwing away when they throw away microseconds."

Dont need to worry about speed of searching the Filesystem, if you dont search the Filesystem 🤣

I was lucky in being able to work on this type of code for a couple decades (Hyperscan, which does high performance regex matching, is a "load bearing" codebase in a lot of security stacks - slow scanning means slow packets). Not everyone loves this particular feeling but I do!

@hansfbaier Absolutely. Modern computers should be running thousands of times faster than they do. Unfortunately bloated software drives the entire hardware industry.

That’s why I’m an embedded software guy. My code is 10000000x more efficient than 99.99 percent of pc coders in 2025

the other thing is that instruction level efficiency is extremely hard to measure correctly due to compilers doing weird things

@TheJyonJon It is not if you know how to use a disassembler

There is a better feeling, even more elusive: coming up with the reason why the code runs fastest Projects that will pay for perf: anything simulation related

That only applies to low low level stuff though. I mostly work on webapps for companies, HR, Accounting etc. If my code has less CPU cycles isnt relevant at all but "does the feature help the HR/accounting department be more efficient ?" that's the only metric I care about

it’s also really hard to optimize at the foundational level. Try building a better math library for calculating small factorials than what python has built in for instance, or trying to build a math library that count extremely large factorials is an entirely different game then just figuring out how to just solve a problem, you have to be able to abstract across the fundamental nature of it and do something entirely new. To beat the speed of the SOTA takes serious innovation.

I actually does it, pretty hard - on few projects. But at the same time, after years doing it, I feel I'm no longer a programmer. I can squeeze the last bit of uops perf out of existing code, but I'm not the first one materializing that code. (1/2)

guilty

Don't worry, Moore's Law will finally die in our lifetime and efficient code will be all the rage again. Hopefully there will still be people alive who know how to optimize so that they can pass down their wisdom to the new generation.

Fast code, fast feedback, fast impact. Yes please.

I also get an ego trip out of making someone else's code 10x faster or more

Just buy a faster computer... yeah, just kidding but the joke was there ;)

How about making code beautiful and readable?

Howevery, those projects are usually very much desired by the end-customer

If it's fun to write fast code that others find difficult to understand, that says a lot about the developer and it's a good thing that this is not fully rewarded.

Steve Carrell to play Linus in the movie `Linux` 😁😁

The next best feeling is adding new features, but your PR takes away more lines than it adds.

embedded.

not everyone can make their code faster than everyone else code just one

the kernel is micro-optimised for sure - but then you get this 4 gigabytes of bloated mess on top with constant never ending auto update where even the folder view keeps crashing for no reason 😞

If you don't care about /0. (double*) a == (double*) b; strcmp. ;)
