Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow
126 points by BaselAshraf81 14 hours ago | 94 comments

zodwick 4 hours ago
I would like to argue that one could make most codebases 50% faster if rewritten from scratch with performance in mind even in the same language.

Taking python as an example, one could use benefit of hindsight and make better decisions from the start ( offloading slow parts to C binaries, better DS decisions, eliminating bloat etc.. ) if they rewrite the same app in Python. This is kind of what happens when a program gets rewritten to another language ( Rust ) - better decisions are made from the start and less bloat is copied over.

Yes, obviously there are exceptions to this. But most of the time it is the choices we make that make the program slow and not the language itself.

It used to be that rewriting programs were almost always a dumb idea due to how much effort went into it - see: https://www.joelonsoftware.com/2000/04/06/things-you-should-... . But AI has made this argument less compelling imo. I now regularly rewrite big chunks of programs with various end goals given to the agent.

reply
rafram 4 hours ago
See uv - replacing pip with a rewrite in Rust was a good stunt, but the big performance gains came from eliminating dynamic features (uv doesn’t allow packages to execute code when installed) and I/O (better caching and parallelization).
reply
zodwick 4 hours ago
Yes exactly, I think this article explains it well :- https://nesbitt.io/2025/12/26/how-uv-got-so-fast.html
reply
dgacmu 3 hours ago
Though to give credit where it's due, it's a lot easier to parallelize things well in rust than in python. The coarse-grained download parallelism is easy in both, of course (though with higher overhead in python), but the more fine-grained solver parallelism favors rust (or c/c++ but let's not do that).
reply
jeffbee 3 hours ago
Every cursed rust application I've been hired to fix has been diagnosed as spending 90%+ of its time pointlessly jumping tokio threads because someone thought that async means fast. I give these 10x throughput boosts by removing concurrency or, sometimes, just rewriting them in Go.
reply
dgacmu 2 hours ago
You're talking about concurrency and I'm talking about parallelism. :-)

Rust's async situation is still a pain in many ways.

But throwing Rayon at something often results in very reasonable parallel performance gains without cluttering things much. It usually won't get you to an optimal solution, but it's good for 80% with 10% of the pain.

reply
jeffbee 2 hours ago
It depends on what you are going for: service latency, or throughput. Rayon's work stealing is inappropriate for any throughput oriented work and questionable for the majority of latency sensitive services. It does have a niche but it's not the first thing I would reach for. Unfortunately it IS the first thing Claude reaches for.
reply
kleiba2 22 minutes ago
A good point in time to mention Casey Muratori: https://www.computerenhance.com/p/clean-code-horrible-perfor...
reply
rented_mule 3 hours ago
I rewrote a C++ batch process in Python 1.4 (this was 1997) and the Python version was ~10x as fast.

The port was pretty direct, function for function. It was even line for line where language and library differences didn't offer an easier way. I was just trying to see if Python was so slow that we couldn't consider using it in production, and this was the most speed critical batch we had.

I assumed the speed difference was a bug that was skipping work, but that seemed unlikely because the output was correct. It turned out to be a bug in the C++ code that was needlessly reproducing work (an issue with cache keys). The bug was extremely subtle. When I fixed the C++, there was very little difference in speed as the batch was I/O bound when the cache was working.

So, adding to your point, sometimes you can greatly improve speed by rewriting in a slower language, even without performance in mind.

reply
drfloyd51 2 hours ago
To be technical about it, the Python program didn’t match the behavior of the c++ program. ;)

But also technically I think your point still stands. Because rewriting it helped you find a defect in the original. Which did improve performance of the original.

It’s quite interesting the two implementations performance was so close in the end. Do you consider one implementation “better” for non-performance reasons? Maybe one type of dev is easier to find. Or one language is easier to create and maintain correctly behaving programs in your environment?

reply
brunoarueira 2 hours ago
About python, I did exactly small things and optimized a data pipeline really well https://brunoarueira.com/blog/optimizing-19-million-rows-pip...
reply
nicoburns 4 hours ago
I mean, it's definitely both. Of course there can be algorithmic improvements, but a like-for-like rewrite of Python code into Rust can often be 10x faster.
reply
rapind 3 hours ago
Don't forget 10x iteration time and deploy time due to building on large projects. Still can be worth it, but I highly recommend build costs (CPU, RAM, Disk, Time) are considered in a rust rewrite decision. I'd even architect around it from the start as it can really add up.
reply
zodwick 4 hours ago
Depends on the application. Tbh the comparison btwn python and rust is kind of dumb. But for the sake of argument - I don't think most well-written Python codebases can get 10x faster by using Rust. Bit faster ? sure maybe. Remember Python uses C under the hood. Unless there is a shit ton of looping or weird unrealistic conditions i don't think this is true
reply
pastel8739 11 minutes ago
I think it totally depends, I’ve seen huge (100x) speed ups by moving a pure-python CPU heavy task to a compiled language. If you’re using something like numpy already to run compute natively, then yes it’s probably much more difficult to get gains.
reply
ThouYS 6 hours ago
neat, but in my experience bottlenecks that you could solve this way are low hanging fruits and optimized away quickly.

the true performance hog is like sand, spread across the system, a little bit in every place.

reply
jodrellblank 4 hours ago
"""If you're looking for the next win, you don't have a hotspot. The CPU profile might look even-Stevens across the board. Let me give you a really simple example of this, I used to work on the [Edge] browser and you could find yourself with a significant regression one week and you're using way more CPU, and you look what the functions are and it's the same functions as always. It's layout and it's style computation, and that code hasn't changed a byte. It's the same excellent layout engine, it's the same excellent style engine, and yet the profiler will tell you you're spending way more time in layout. What's happened?

Somewhere in your code is a little whammy where someone invalidated a bunch of tree nodes which took about 8 nanoseconds and caused the layout engine to now do tons of computation that it didn't have to do before. No profiler in the world is going to save you from this problem, it's going to tell you that the problem is in the layout code. Well duh, thanks for that, of course the compute is in the layout code, it's always in the layout code, all we do is layout and draw. So I have to find the 3 nanoseconds where somebody invalidated something that they have no business invalidating because it's wrong. And the way you fix that is [to have a sense of how to check that you're invalidating the right thing, regression testing, visualizations, logging, planning] and it could be literally 4 or 5 instructions dirtying the cache and that's not going to show up in a profile.

[paraphrasing; Casey: if you've developed the whole browser without caring about this, at the end you're going to find it very slow and not be able to squeeze any more performance out of the layout engine? Rico: Right, this is not something you can fix at the finish line, it needs a plan]"""

- Rico Mariani, interview: https://youtu.be/48Rig6v-xYU?t=3615

reply
IshKebab 5 hours ago
Exactly my experience. You can make Python code faster by profiling and improving the hotspots, but once you've done that it will still be 10x slower than C++/Rust at least, and that slowness is evenly spread through the whole program.

The number of use cases where you actually can move just a small part of the program to C++/Rust and that solves performance is actually really small. Basically highly numerical things like AI or SMT solving. Even supposedly IO bound things like Django tend to be quite slow in Python.

reply
szundi 5 hours ago
[dead]
reply
sham1 5 hours ago
A lot of lost performance also comes from things like the architectural decisions and technical debt that would pile up over time. These considerations are also like sand in that they're coarse, rough, irritating, and they get everywhere in the codebase.

Oh, and they can be annoying to refactor later on.

reply
embedding-shape 4 hours ago
Using the right data structures for the right usage later on is like half the battle. People get really annoyed when you show them a Python program that is faster and shorter than someone's C# program, merely because they used the wrong data structures for how it's being used.
reply
kamma4434 3 hours ago
One of the nicest things of Java is that a list is a List<>. You can start with the default ArrayList or use a ton of other variants, or write your own, and all that changes is one line of code
reply
hendler 8 hours ago
It's also OK to rewrite in Rust because it's not just about performance. The fast part in other Python, Ruby, etc may be written in C/C++, or call an external library, and be the vulnerable part.
reply
the_arun 2 hours ago
Java - “1.18s, 3× (11× on the function; the rest is JVM startup)” - why are we including JVM start up? Can’t we assume Java is already started? We don’t start JVM for every function. Right?
reply
osigurdson 3 hours ago
I did an experiment to see how small and efficient I could make a desktop Linux app. One thing I learned is GPU adds a lot of memory overhead without much benefit for very basic apps.
reply
micahcc 13 minutes ago
Only put it on the GPU if you have thousands of nearly identical operations to do
reply
alexfromapex 2 hours ago
I didn't realize until I rewrote in Rust that psycopg2 is about as fast in Python as Rust database calls because it's all compiled in C. I had to do the full re-write because my code was going to live on customer machines and I didn't want them stealing IP. The speed, stability, and security boosts are just added bonuses.
reply
diegocg 9 hours ago
Better yet, stop writing large codebases in lenguajes that will have performance troubles.
reply
tripledry 9 hours ago
Genuine question, is this a common problem people see out in the wild? In my dayjob(s) I've basically never seen major slowness that comes from using something like nodejs / python, the bigger culprits have been network / db / bad architecture or code.
reply
the8472 4 hours ago
Python and Ruby are single-threaded (yesyes, there's noGIL python now), which in turn means they're deployed as multi-process services, which means they must be stateless, which means there is a lot less you can keep in-memory and need to offload to external stateful systems. And that's how you get your bad architecture.

And python being interpreted and dogslow means any heavy computation you write in pure python needs to be offloaded too instead of just putting it on a threadpool, again making your architecture more complicated.

Add in serverless functions, which need startup, and now something that should have taken microseconds will take seconds.

Node is JITed at least, but still no shared-memory multithreading, so it still encourages all the architectural bloat.

reply
chrismorgan 8 hours ago
Performance is broader than just slowness; it’s also CPU and memory usage, things which will force you to scale horizontally (multiple machines) much sooner.

In mid-2013, NewsBlur described in some detail their deployment and statistics. Python/Django, 48 servers. I confidently calculated that, with implementation efficient, one would be sufficient, though with little headroom, and further vertical scaling might have started running into I/O limitations. (I doubt a single server would be possible any more.)

It’s popular to scale horizontally far earlier than you actually need to. And if you can commit to sticking with vertical scaling (single big machine), you can simplify (and further speed up) things enormously.

I don’t know about now, but five years ago HN ran on a single server <https://news.ycombinator.com/item?id=28479595>, though with a standby machine also present since 2017ish.

reply
kamma4434 3 hours ago
True, but scaling out helps with more than load sharing. Singletons are always a risky architecture - what happens when they go down?
reply
chrismorgan 58 minutes ago
They’re risky in that sense, but their very simplicity makes them less subject to other sorts of failures—distributed systems have more and more complex failure modes.

Personally I think it’s a very good trade-off for vastly more businesses and services than actually practice it.

I suspect I may have seen more systems run into availability problems from unnecessarily distributed architectures than from hardware failure, and I’ve definitely seen costlier development due to it.

reply
andyferris 8 hours ago
Yeah, Python is one I where I find moderate amounts data can be a pain - I end up tempted to move CPU work to the database or precompute more things, and it’s hard to get the advantages of single binary programs (for deployment, startup time, etc).

(For big data you can use Python to drive some native code frameworks - it is good at that, for tiny data it’s irrelevant because there’s not much to do, but the moderate case gets awkward).

reply
FartyMcFarter 8 hours ago
Yes. Python is usually 10-100x slower than languages like C, C++ or Rust. If your program is CPU bound, this shows up very obviously. If it isn't, you may never notice at all.

Imagine being able to use only 1% of the machines you used to require, by migrating away from Python. This is very realistic for companies doing heavy computational work.

reply
rhdunn 7 hours ago
Libraries generally write hot code in languages like C, C++, or Rust and bind that to Python (PyTorch, etc.) or provide bindings/wrappers around libraries in those languages (SQLite, PostgreSQL, etc.).

As with anything performance related you need to profile the code with realistic data/workflows and identify the parts that are slow.

Typically, doing things like changing algorithms, data structures, careful use of caching, reusing calculations, etc. are more important to performance than the choice of language.

reply
fiedzia 47 minutes ago
> Typically, doing things like changing algorithms, data structures, careful use of caching, reusing calculations, etc. are more important to performance than the choice of language.

The choice of language determines the extent to which those things are possible. In case of Python using C libraries sometimes means that you pull data from somewhere, hold them in Python memory in very inefficient way, pay for transformation to another form that C library uses and then do the same in reverse at the end. Perhaps even more times if C doesn't handle everything. "Use C libraries" often works, but is not universal solution.

reply
cadamsdotcom 8 hours ago
What you're saying is valid too; but, the post you're replying to implied most slowness is network (i/o bound) or bad architecture (accidental cpu bound, fixable by tech debt cleanup).
reply
FartyMcFarter 8 hours ago
That post was also asking if other people have seen language mattering. In the places where I've worked programs are often CPU bound. Places like these are why compiled languages are still alive and kicking.

I'm not denying that domains exist where being I/O bound is a thing. For those cases Python can be a fine choice.

reply
cadamsdotcom 7 hours ago
We all have different lenses on the makeup of the entire set of software out there, it's likely you're coming from that experience and the other post was coming from experience mostly with i/o bound software.

For cpu bound stuff the language makes potentially an enormous difference; but then you get to trade off: eg. if you're not gonna need a fast language you are free to choose based on other considerations.

Might still both pick the same language though ;)

reply
pessimizer 7 hours ago
This conversation is pointless. The answer to whether some people see actual problems in the real world© with using very slow interpreted languages is "yes."

I'd make the case that everything on a computer is CPU bound depending on scale, even your crud app. Half the time when somebody is saying that X is I/O bound, they actually mean that it's bound by the performance of their database - which wisely, in the real world, is not written in python.

edit: and, of course, things in python that would run terribly slow if written in python become primitives, which are written in C. Python is a C program.

reply
pdhborges 5 hours ago
The easiest way to have an I/O bound workload is to use fast languages.
reply
xtracto 4 hours ago
I recently built a small nextjs/node application that basically makes like $50 usd monthly. Initially built as a PoC, I wanted to place it in a vps so that I didn't have to maintain it in my home laptop, and also because I wanted to move it to a Europe location for better business performance [im in mexico and latency is high].

Thing is, the TS app weighted around 4GB overall and took 2s to do its thing. [A backend process, an http api and a static website generator].

I needed to decrease the size and increase performance dramatically,to be able to put it in a 2GB 2vcpu instance, which costs $12 monthly. Otherwise it would eat the profit.

Claude ported it to Rust, in around 2 days total. And it went down to 1.5Gb max, and 1/10 of the CPU usage. Now it sits in the aws europe zone making money.

reply
embedding-shape 55 minutes ago
What exactly is it doing during these 2 seconds? What did it stop doing for those 2 seconds to become whatever it is now? Did Claude use a different (more fitting) design, architecture and data structures perhaps? Did Claude also write the initial version?
reply
owebmaster 24 minutes ago
Was it Claude that made the terrible choice of using nextjs in the first place?
reply
austin-cheney 6 hours ago
Maybe. When I stress test my JavaScript application I can push up to 6,000,000 WebSocket messages per second in Node (C++) but do experience some amount of memory instability. When I run the same application on Bun (Rust) it’s not as fast but it’s extremely stable.

In all fairness 6,000,000 messages per second across a single socket is likely an unrealistic scenario but application stability over multiple months pushing out message traffic across many sockets from many servers under a single application process is a realistic concern as is number of simultaneous open sockets.

reply
afavour 5 hours ago
In my experience memory issues are more common. The way JS stores objects in memory is fundamentally inefficient (though it’s deliberate, it’s why you can do object.propertyIJustMadeUp = true on anything, any number can be a float, etc) and if you’re moving a ton of data it can cause issues eventually.

The only JS-native answer is to use typed arrays, which is using a sledgehammer to crack a nut.

reply
fiedzia 5 hours ago
Mostly because anything that needed to be fast already was written in a language that allows that and most of web/app development focuses on shuffling small amounts of data around. Also pure Python is worse than node in this aspect. Still, there many non-trivial cases. There is a reason most of infrastructure moves to Rust. I've seen poetry spending 30min (!) on dependency resolution once. Test runners and some background/nightly data processing if often first place where you realize you may want to rewrite.
reply
IshKebab 5 hours ago
Yes. Most often with Python. People think performance isn't going to be a problem and by the time it inevitably is, it's far too late to use a better language. (At least before AI.)

I've seen this at almost every company I've worked at.

reply
anatolii1309 5 hours ago
[flagged]
reply
tialaramex 7 hours ago
Note that this strategy only works if 5% of your software is the problem - because of Amdahl's law.
reply
perdy 9 hours ago
We took this route in a Python web framework I maintain: route matching, JSON encoding, request body parsing, compression and some other specific parts moved to Rust with PyO3, everything else stayed in Python.
reply
krmmalik 6 hours ago
How do you feel about your decision now that this has been done? Was it worth it or not?
reply
perdy 4 hours ago
For the parts that scale, yes. I build a CI step for measuring the performance with Callgrind since last pure-python release, and we achieved good numbers: matching the last of 200 routes dropped to about half the cycles and serializing a large JSON to about 25% less. So it pays off for work that grows with the input.
reply
ezbie 2 hours ago
I dont get the point of this.

Developers rewrite code in rust for memory safety, not speed.

reply
adsharma 2 hours ago
Write in a variant of python that can be machine translated to rust. If you're using agents you might need an intermediate step.

Py2many is an implementation of these concepts.

reply
vkaku 3 hours ago
There is the other argument to rewrite it in something - delayer complexity where it doesn't solve an understanding problem. This has led to a phenomenal code decrease where rust primitives tackle a ton of structured case handling while keeping code simple and readable.

Rust itself had an understandability issue until LLMs came along and started speedrunning parts of the Rust development process, so this argument is language AND time immaterial.

reply
efficax 2 hours ago
ffi boundary often means you lose any gains from rust to packaging up the data and shipping it via c structs back and forth between the language runtime and rust
reply
Bolwin 5 hours ago
The results section feels a bit like a joke. They rewrote C and C++ to Rust for performance?

And something tells me C# and Java could have gotten 90% of the improvement without any rewrite. I'll have to try later today.

reply
stackskipton 4 hours ago
It looks like it finds hot paths, rewrites them into Rust so you can just insert them into Python code vs rewriting everything into C# or Java.
reply
raincole 5 hours ago
I'm... not so sure why you need a repo for that. It's almost 2027. You can literally just type "profile this app and find out the performance bottleneck" then "rewrite it in rust" in your agent TUI...
reply
Almondsetat 4 hours ago
This way the trickiest parts of the codebase get reweritten in a language you don't even know...

Doesn't seem a recipe for success

reply
solyin 4 hours ago
Nah. Do it in Swift.
reply
Kuyawa 3 hours ago
Exactly, if you are on Mac/iOS there is no better language

"When in Rome, do as the Romans do"

reply
Dwedit 4 hours ago
This looks very AI-generated.
reply
afdbcreid 9 hours ago
Funny that this codebase is 62% Rust, 9% Python. And I'm a huge Rust proponent.
reply
stavros 5 hours ago
Why is that funny? He rewrote the slow 9% in Python.
reply
anttiharju 10 hours ago
Hah, pretty neat!

I recently discovered that one can apparently distribute Rust projects on npm by compiling to wasm. action-validator used to do this. Had been thinking about something like this.

reply
combobyte 9 hours ago
Doesn't that kind of defeat the purpose? Compiling to WASM is going to erase any speed advantage you'd get from native Rust.
reply
himata4113 9 hours ago
wasm compiled to native is only ~62% slower (LLVM) and only 3% slower for non memory bound operations.
reply
fukaiall 2 hours ago
I don’t mind rewritting in any language. But the one in Rust looks more like led by asshole-like cult and for showing off to others than pure engineering purposes.
reply
tomp 5 hours ago
Or just rewrite in Numba.

Most often, Python is enough.

reply
fiedzia 5 hours ago
Hell no. Rust is easier to read, write, maintain and reason about. Way more people know Rust than Python/Python internals/Numba interactions. Numba will either get you relatively low gains with little effort, or push into territory very you write code few people will understand, because reasoning about its performance requires deep knowledge of Numba and Python internals. Rust gives a lot more ROI and looks more like Python.
reply
odiroot 3 hours ago
"Easier to read" is really doing a lot of work in this statement. Highly debatable.
reply
simonask 3 hours ago
Harder to read, easier to understand.
reply
toxik 5 hours ago
Not my experience, actually. Numba and other such techniques (like having some hot paths in C/Rust/whatever) works, but eventually just allocating and deallocating Python objects starts to become a measurable problem. Especially if you have any kind of fancy metaclasses, descriptors, etc. "So don't"--ok, so give up Python's dynamic features? Why bother at that point. Now it is so cheap to write code anyway, why bother with Python at all? Have a design document in actual English.
reply
tomp 4 hours ago
No language will save you from inefficient memory allocation patterns.

But if you can optimize C, most often you can also optimize Python.

I have a SLAM implementation in pure Python+Numba where all points/keyframes are kept in a single flat table, no allocation.

reply
searealist 6 hours ago
This cope was common 20 years ago with Python. It rarely worked out. It's rare that 5% of your program is taking up that large a percentage of your execution. It's usually much more spread out than that.

Also, we have LLMs now. Rust should be the default for many things.

reply
benjiro29 5 hours ago
"Also, we have LLMs now. Rust should be the default for many things." ...

Or C Or Go Or ... Its like people can not look past one language, to understand that with LLMs, a ton of languages gotten way more easy.

Personal experience that running a few subagents parallel with Rust, just slows everything down to a crawl, even wit ccache and a ton of other tweaks. As long as your codebase is a few 100k lines, Rust is ok. But start going in the 500k, 1 million... starting to get C++ flashbacks where your spending more time waiting on the compile jobs, that fight each other for resources then actual testing.

Until Rust can fix their slow and resource munching compiler, its been off the menu for me. Ended up having everything in C and the difference was very noticeable.

reply
jghn 5 hours ago
Didn’t you know that rust is the awesomest most ultimate language ever!?!
reply
arbor-group 3 hours ago
[flagged]
reply
Prospernwo 8 hours ago
[flagged]
reply
manfred_singer 9 hours ago
[flagged]
reply
egorfine 8 hours ago
What does %LANGUAGE% have anything to do with the goal? Totally same principles apply for any other lower level language: Zig, C.

While Rust is awesome, a lot of times the only apparent reason to chose Rust over C is virtue signaling.

Update: like I said, Rust is awesome and has so many advantages over C it's not worth a discussion really. But again I see that many projects are choosing Rust not because of merits but simply because it's a fashion.

reply
eterm 8 hours ago
> the only apparent reason to chose Rust over C is virtue signaling

If you'd said another memory safe language I might have been on board, but C? We've seen a complete collapse in the ability of software to go un-hacked and un-exploited. Not all of that is down to poor memory safety of course, but it's a category of vulnerability that is massively increased in both surface and risk by choosing to write C.

Choosing Rust alone might be virtue signalling, but choosing a memory safe language is just pragmatic.

reply
tialaramex 7 hours ago
In this particular topic (performance) Rust matters because it will deliver excellent performance. You could write a container -> map -> map -> container flow in fifty memory safe languages, but probably it would be a bit slower than the nasty hack you'd write in C to convert the data in place. Rust isn't, if you're intrigued you will discover that Rust 1) figured out that the two containers must be the same size in memory so it can re-use the original container and 2) did the in-place conversion even though that wasn't what you wrote, because it's faster.

So magically the Rust was just as fast, but much more readable and when a junior (or an LLM) modifies it slightly so that the output container is bigger it won't suddenly segfault due to that scary in-place conversion loop now being a bounds miss, the Rust won't attempt the in-place conversion now that it can't work.

reply
curt15 6 hours ago
In the age of machine-generated code, why not ask LLMs to write "safe C"?
reply
eterm 6 hours ago
You've received downvotes, but I'll do you the kindness to actually answer you.

Firstly the obvious, LLMs aren't perfect yet, they still make mistakes.

But even if they could achieve safe C by asking them to "Write Safe C, Make no mistakes", there would still be a significant benefit to achieving safety by using Rust or a memory safe language.

LLMs work best when they have a combination of clear objective functions and guardrails. In this case, the compiler acts as a guardrail to keep it safe while trying to solve the problem that needs solving.

Having a compiler step prevents the LLM taking a "shortcut". Despite models improving, they will still take shortcuts, sometimes absurd ones, to meet some definition of a "job done".

The other massive benefit is cost and speed. Having an LLM analyze and reason about the safety is expensive and wasteful. Having this done at compile time is cheaper and quicker. The earlier in the feedback loop, the cheaper it will be.

Save your tokens for "real" work, not stuff you can check at compile time.

reply
QuantumNomad_ 8 hours ago
> a lot of times the only apparent reason to chose Rust over C is virtue signaling.

Quite the opposite. Outside of a couple of very specific kind of cases (for example working with microcontrollers not supported by Rust toolchain), there is no good reason to choose C when you could choose Rust.

Choosing C over Rust means throwing away the memory safety features that Rust gives you for free. And for what? There is just no upside to choosing C in the vast, vast majority of cases.

reply
virtualritz 8 hours ago
That's a pile of bollocks.

Rust protects you from a whole class of bugs (borrow checker) and lets you enforce almost as many invariants as you chose, through the type system.

LLM are just as bad as humans at enforcing/tracking ownership and invariants.

We maintain two code bases; one is TS and the other Rust.

Both are by now written foremost by agents (since August 2025, I'd say).

We had numerous non-(business)-logic bugs in the TS code base over this period.

Zero such bugs in Rust. Because the compiler catches them for us. All bugs we had in that code where actual logic bugs. I.e. the spec already had the bug or contained an oversight.

Zero.

We have since started rewriting the TS code base in Rust and will likely switch over in the next three months.

reply
tialaramex 4 hours ago
> virtue signaling

Seems like just virtue to me. The guy who volunteers every week to pick up garbage from the beach isn't virtue signalling, he's just virtuous. The guy who came once, with a film crew and left once they'd got the shots they wanted - that is virtue signalling. They're both shown in the film, but only one of them actually does the signalled virtuous activity when the cameras aren't rolling.

You could argue that RIIR was conducted as virtue signalling if what we saw was one of those translations smeared in unexplained unsafe blocks, with rats nest logic that no human is going to untangle. But that doesn't seem to be the case here.

reply
jph 8 hours ago
Today I added Rust checked arithmetic which detects and protects math bugs such as integer addition overflow and division by zero.

Rust checked arithmetic is built into Rust's standard library (std) via explicit methods on primitive integer types (such as checked_add, checked_sub, checked_mul, and checked_div), which return Option<T> and evaluate to None on overflow. There's a known tradeoff of some speed, which is fine for my purposes because I need reliability more than raw speed.

I'm longtime C coder so I know how to do this in C. Rust strong types and static analysis make it so much easier to do correctly.

reply
Conscat 7 hours ago
This is in the C23 standard library as well, just without nice sum types sadly.
reply
uecker 2 hours ago
It is very easy to add one yourself though.

https://uecker.codeberg.page/2026-10-24.html

reply
booi 8 hours ago
That's actually why we chose Rust over C at my new company, Virtual Signaling as a service™. We rewrite anything in Rust for companies looking to virtue signal.
reply
jstanley 8 hours ago
Rust's incredibly strict and detailed static analysis, while a huge headache for human developers, is really useful with LLMs.
reply
IceDane 8 hours ago
> While Rust is awesome, a lot of times the only apparent reason to chose Rust over C is virtue signaling.

That seems like an extremely dubious claim.

Rust is just a lot more pleasant to work with in every possible way. C has the abstractive capabilities of a deaf-blind toddler.

reply
uecker 2 hours ago
I found that you can not build good abstractions in C is mostly a myth.
reply