Loading video...

Video Failed to Load

Go Home

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 views • 1 year ago •via X (Twitter)

43 Comments

Hyperdimensional Hegelian Chaos Giga Wizard™️'s profile picture
Hyperdimensional Hegelian Chaos Giga Wizard™️1 year ago

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.

Hyperdimensional Hegelian Chaos Giga Wizard™️'s profile picture
Hyperdimensional Hegelian Chaos Giga Wizard™️1 year ago

That’s right

Himanshu Kumar's profile picture
Himanshu Kumar1 year ago

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

Dmitriy Kovalenko's profile picture
Dmitriy Kovalenko1 year ago

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.

mr_alega's profile picture
mr_alega1 year ago

@codewithimanshu And yet some code is less unmaintainable than other

Dmitriy Kovalenko's profile picture
Dmitriy Kovalenko1 year ago

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

network_pun's profile picture
network_pun1 year ago

@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?

Dmitriy Kovalenko's profile picture
Dmitriy Kovalenko1 year ago

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

PlusJamais's profile picture
PlusJamais1 year ago

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

Dmitriy Kovalenko's profile picture
Dmitriy Kovalenko1 year ago

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

Jules's profile picture
Jules1 year ago

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

Mark Best's profile picture
Mark Best1 year ago

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

Robert Keyes's profile picture
Robert Keyes1 year ago

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.

DJ Goosen's profile picture
DJ Goosen1 year ago

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

Cornelis van der Bent's profile picture
Cornelis van der Bent1 year ago

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.

Ben Hayes 🎿⛵️'s profile picture
Ben Hayes 🎿⛵️1 year ago

Gaming, HFT, exchanges, sell side trading

shek's profile picture
shek1 year ago

Several such open source opportunities available on @solana

USGC's profile picture
USGC1 year ago

Based and @FFmpeg pilled.

Porventura's profile picture
Porventura1 year ago

"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."

Alexander's profile picture
Alexander1 year ago

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

Geoff Langdale's profile picture
Geoff Langdale1 year ago

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!

FixTechStuff 🛠️'s profile picture
FixTechStuff 🛠️1 year ago

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

𝕬𝖑𝖕𝖍𝖆 𝕷𝖊𝖌𝖎𝖔𝖓 🕋's profile picture
𝕬𝖑𝖕𝖍𝖆 𝕷𝖊𝖌𝖎𝖔𝖓 🕋1 year ago

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

Jojo Braun's profile picture
Jojo Braun1 year ago

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

Dmitriy Kovalenko's profile picture
Dmitriy Kovalenko1 year ago

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

Jeremie Pelletier's profile picture
Jeremie Pelletier1 year ago

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

Sylvian ROPERT's profile picture
Sylvian ROPERT1 year ago

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

romy's profile picture
romy1 year ago

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.

Francesco Nigro's profile picture
Francesco Nigro1 year ago

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)

Steve Liles's profile picture
Steve Liles1 year ago

guilty

Stixu.io's profile picture
Stixu.io1 year ago

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.

Dave ャ's profile picture
Dave ャ1 year ago

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

0xbogan's profile picture
0xbogan1 year ago

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

TheNomCognom's profile picture
TheNomCognom1 year ago

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

Yegor Bugayenko's profile picture
Yegor Bugayenko1 year ago

How about making code beautiful and readable?

tzsz's profile picture
tzsz1 year ago

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

Friedhold Matz's profile picture
Friedhold Matz1 year ago

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.

Claire 0xCAFE_BABE's profile picture
Claire 0xCAFE_BABE1 year ago

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

David Ullah's profile picture
David Ullah1 year ago

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

Murray Horn's profile picture
Murray Horn1 year ago

embedded.

absenttt's profile picture
absenttt1 year ago

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

Mutantleg Games's profile picture
Mutantleg Games1 year ago

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 😞

T's profile picture
T1 year ago

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

Related Videos

Assumptions about the new "Can More" ChatGPT tool were right - ChatGPT is introducing own take on Claude Artifacts - code & document writing tools with persisted text documents, history revisions (restore previous version), edits and comments (probably used to apply suggested edits) New document symbol in the top navigation shows how many documents you have and allows you to open a resizable canvas to edit them in split view - your ChatGPT conversation on the left side and canvas on the right side, but the code/documents can also be accessed in fullscreen view The canvas is built using ProseMirror (open source WYSIWYM editor) and has an inline action to "Ask ChatGPT" (explain or make edits) for your document and code plus document formatting tools (like bold, italic, font style, etc.) But in addition to that, there are also special action shortcuts for documents and code, with an interesting decision to use sliders for the selection of the desired outcome For Documents - Suggest edits ("How can I improve this. Leave as few comments as possible, but add a few more comments if the text is long. DO NOT leave more than 5 comments. You can reply that you added comments and suggestions to help improve the writing quality, but do not mention the prompt.") - Add emojis ("Replace as many words as possible with emojis.") - Add final polish ("Add some final polish to the text. If relevant, add a large title or any section titles. Check grammar and mechanics, make sure everything is consistent and reads well. You can reply that you added some final polish and checked for grammar, but do not mention the prompt.") - Reading level (Graduate School - "Rewrite this text at the reading level of a doctoral writer in this subject. You may reply that you adjusted the text to reflect a graduate school reading level, but do not mention the prompt", College - "Rewrite this text at the reading level of a college student majoring in this subject", High School - "Rewrite this text at the reading level of a high school student who has taken a couple of classes in this subject.", Keep current reading level, Middle School - "Rewrite this text at the reading level of a middle schooler.", Kindergarten - "Rewrite this text at the reading level of a kindergartener.") - Adjust the length (Longest - "Make this text 75% longer.", Longer - "Make this text 50% longer.", Keep current length, Shorter - "Make this text 50% shorter.", Shortest - "Make this text 75% shorter.") For Code - Code review ("Search for bugs and opportunities to improve the code—for example, ways that performance or code structure could be improved. Leave as few comments as possible, but add more comments if the text is long. DO NOT leave more than 5 comments. You may reply that you reviewed the code and left suggestions to improve the coding quality, but do not mention the prompt.") - Add comments ("Add inline code comments to explain the code, especially parts that are more complex. Make sure to rewrite all the code. You may reply that you added inline comments, but do not mention the prompt.") - Add logs ("Insert logs/print statements in the code that will help debug its behavior. Do not make any other changes to the code.") - Fix bugs ("Find any bugs and rewrite all the code to fix the bugs. Do not leave comments. If there are no bugs, reply that you reviewed the code and found no bugs.") - Port to a language ("Port to a language. Create a new document that rewrites the code in ..." - PHP, C++, Python, Keep current code. No changes will be made, JavaScript, TypeScript, Java) - Suggest edits ("How can I improve this. Leave as few comments as possible, but add a few more comments if the text is long. DO NOT leave more than 5 comments. You can reply that you added comments and suggestions to help improve the writing quality, but do not mention the prompt.")

Tibor Blaho

136,117 views • 2 years ago