logoalt Hacker News

thimabi • today at 1:45 PM • 3 replies • view on HN

> When someone asks, “why don’t you rewrite ESLint in Rust?” what they’re really asking is, “why can’t ESLint be faster?” […] People have equated Rust with fast executables, so instead of asking the real question, they jump directly to what they believe is the solution. Rust is fast, ESLint is not, therefore ESLint built on Rust is the answer.

I’ve never heard this framed in this way and this is, in fact, a very powerful argument. Rust code benefits from memory safety, from the compile-time guarantees that make it easier for AI agents to write and maintain it… but at the end of the day many people like Rust mostly because it facilitates building more performant software.

I wonder if the vast majority of that performance boost could be obtained if efforts were directed towards improving programs in their own language, like the ESLint team is doing, rather than going straight for a full-on rewrite in Rust. My nagging suspicion is that this is very much possible, as seen for instance in VS Code pushing the boundaries of Electron apps. But that does require some effort.


Replies

insanitybit • today at 1:52 PM

> I wonder if the vast majority of that performance boost could be obtained if efforts were directed towards improving programs in their own language, like the ESLint team is doing, rather than going straight for a full-on rewrite in Rust. My nagging suspicion is that this is very much possible, as seen for instance in VS Code pushing the boundaries of Electron apps. But that does require some effort.

I just don't think so, personally. You just really don't have to try when it comes to things like 0 allocation in Rust, and when you do put in effort it's for things like explicit SIMD. For something like typescript you have to put in a lot of effort for 0 allocations and then something like explicit SIMD just isn't really on the table.

In Rust I have real threads, I can manage IO, etc.

I'm sure you can push these languages and runtimes very far but there just are limits.

I've seen this so many times. Even with binaries or services that people say spend 90% of time in IO, I've sped them up with naive ports to Rust. Why? Because IO in Rust is going to be faster - freeing up your event loop by reducing contention will reduce latency, reducing allocations will reduce latency, control over task allocation will reduce latency, etc. I've just seen it too many times where "it's just a dumb pipe between services, language doesn't matter" turns out to be "language bound".

I'm sure they will improve performance by optimizing their use of the language but it's just not going to compete with a rust implementation.

__s • today at 1:52 PM

IME Rust is easier way to reach perf improvements & has higher ceiling, & this goes back to rewriting a cardgame engine pre-AI (both engine in wasm & server from node)

I'd spent years tuning for JITs & it was so nice to not have to worry about their fickle nature

But I also don't think people should think they're helping by opening issues rambling about RIIR. It's up to the project leads & don't worry they know about Rust. Rewrites are not something for flyby PRs to implement

cavoirom • today at 1:57 PM

> Rust code benefits from memory safety, from the compile-time guarantees that make it easier for AI agents to write and maintain it…

Rust is not "safe" as you think unless there is no "unsafe", no FFI, no link to C library and libc.

For example, Java is memory safe but the recent Java4Shell happen because it uses unsafe code to handle base64.

➕ show 1 reply