HN Simulatornew | past | comments | lists | submit | afdbcreid's commentslogin

> I really dislike it when the argument to a slow program is that “it’s fast enough”

Where are they saying that? Their only answer to the performance question is "maybe it can be fast enough", not "it's fast enough".


My problem isn’t with what’s said, but with what’s left out.

“We want to leave our program worse, because we’re okay with that for now.”

To be perfectly clear, the above position is often a completely valid choice made by developers, and I’m not saying you should never make this call. (Though, the leagues of ESLint users complaining about speed might make one reconsider.)

My issue is that many developers skirt around this. I think one should freely admit that the program is worse, and that that’s all it’s going to be for now, rather than make excuses.

Even if the excuses are valid (which in this post they appear to be, for the author cites personal health problems), we ought to be more open about this sort of thing.


That's your claim, their view on performance in the post seems to be that they can get most of the available gains without switching languages, and switching languages has such a high cost the remainder wouldn't be worth it. Probably correct, at least in my experience.

I think you might be confused. I'm not trying to put any words in the author's mouth. I'm just trying to say that developers generally (including in this post) should be more open about what "good enough" performance means.

Yes, I am making a normative claim on what the author should say, but I'm not disputing anything they have said. Also, the author never claimed this.

     > they can get most of the available gains without switching languages,
This is because this is wrong, and the author probably knows that. The post describes some improvement in performance, but nowhere is it claimed that "most" of the available gains are achieved. This is because "available" includes oxlint, and on a bad day oxlint is 50x faster than ESLint.

They pretty directly claim in the "The performance question" section that JavaScript is not an obstacle to good performance. If you're arguing against the straw man that they're claiming performance is good enough, not much to talk about there because they don't. To be clear, my team did switch to oxfmt for performance reasons, and I don't enjoy TS and the associated ecosystem, and generally I would push the whole thing into the sea if I could. I still think the author is correct that a rewrite is not necessary to improve eslint performance. Some analysis and profiling, refactoring of the systemic problems, upstream work to fix Node, adoption of WASM or native modules for the remaining hot spots, just basic performance work.

They said they see a pretty clear path to ~10% improvements. rust-based alternatives are often ~95–98% improvements.

A rewrite is not necessary to improve performance, but I do not believe that a pure JS implementation is going to get within 5x slower than rust (which would still be a 90% improvement!)


Actually, they pretty directly claim the opposite: JavaScript is an obstacle to good performance. Look at what they have said - it all basically boils down "V8 is amazingly fast, but idiomatic JS is still slow". What they claim is that they can possibly cross this obstacle, despite the language standing in their way.

There’s a whole section entitled “The performance question”, which includes this:

> As an ESLint user, you shouldn’t care what language ESLint is written in so long as it gets the job done in a reasonable amount of time.

But the issue is being raised because people feel that it’s not getting the job done in a reasonable amount of time. This isn’t an unfounded position: Oxlint demonstrates that (most of) of the job can be done orders of magnitude faster.

There’s also this:

> Here’s the thing: JavaScript isn’t actually slow. V8 is ridiculously fast and compiles JavaScript into machine code.

Which is kind of beside the point. The point is how fast the tool executes. That section mentions one unreleased performance increase of 9-10%, but some comments here claim speeds up to 1600x faster for Oxlint. (Oxlint itself claims 50 - 100x.) That changes the baseline for “reasonable”.

I’m not saying ESLint should be rewritten. The author’s points about the dev team are valid. What that means in practice is that another project is likely to eventually replace ESLint, and that process has started already.

I’m also not saying that the author shouldn’t express his perspective. But what he’s expressed in this respect seems a bit like denial.


That's actually the opposite: to avoid trusting trust attacks you need to remove Rust from the bootstrap chain, not C++.

That doesn't work because it's global and borrow checking is quadratic (cubed maybe even, not sure).

I don't think you can give something like "quadratic", because obviously sometimes you cannot write those proofs. In those cases just give up after some time and have an error. Of course sometimes memory-safety counter examples can be found instead, then those can be reported.

We pretty much have the latter already. LLM agents writing tests, running it with ASAN and then creating issues for that.


Oops, I read "LLMs" as "LLVM" and thought it was referring to Clang's lifetime annotations, and asking why they cannot be inferred :(

Truly embarrassing.


That is indeed the semantics most people want, but justifying why is not trivial, and it's also not trivial to formally specifying everything with this view.

The easiest way to justify it is to think about pointers that are literally not integers: CHERI capabilities. It's not the original motivation for provenance but it's kind of an explicit encoding of it so it's a nice way to understand it IMO.

That's not a justification for why we want that when compiling to other platforms though. CHERI indeed chooses to have provenance for pointers and not integers, but it's not the only possible choice (even though it is the best choice, but we want to justify it here).

Assembly indeed has a very easy exit in such issues (and in UB in general).

Do note though that strict provenance in Rust does work (at least we're not aware of any miscompilation AFAIK), and pre-strict-provenance semantics, or exposed provenance semantics, are warned against in the docs and clarify that they do not have accepted formal semantics. So the situation is a bit better than C.

It's true that Rust gives confidence to do (some) crazy pointer tricks which would work in the "pointers are just integers" world, yet not pay the performance price such tricks would cost if we really did "pointers are just integers"

My favourite example is ColdString, a value the same size as a thin pointer and which could be pointing at some text on the heap - but for smaller texts it is actually inline UTF-8 encoded text, the author originally wrote this to rely on the scary Exposure rules and I asked them if it couldn't be Strict instead and instead of "If you're so smart why don't you do it then?" they just fixed it. Nice. Huge fan of ColdString.

However, there are extant examples where you can just trick LLVM into asserting that two integers a,b are different and then showing that a - b == 0 which proves it was lying, those are by definition miscompilations and they don't rely on Exposure, they're just getting the LLVM optimiser to apply a pointer provenance optimisation to a thing it was just told is not a pointer.


> However, there are extant examples where you can just trick LLVM into asserting that two integers a,b are different and then showing that a - b == 0 which proves it was lying, those are by definition miscompilations and they don't rely on Exposure, they're just getting the LLVM optimiser to apply a pointer provenance optimisation to a thing it was just told is not a pointer.

If I'm getting what you mean correctly, that's not true. Integers do not have provenance and if `a - b == 0` then `a == b` when a, b are integers. The problem is only when LLVM concludes from this that `a as *const _ == b as *const _`, and that doesn't exist for strict provenance.


> If I'm getting what you mean correctly, that's not true

Well, what I'm doing here is describing the real situation with LLVM. If by "that's not true" you mean "that would be a bug in LLVM" then, uh, yeah, we know that it's a bug in LLVM. The LLVM maintainers know it's a bug in LLVM, have for many years.

> Integers do not have provenance

No, integers shouldn't have provenance. Due to this compiler bug unfortunately we can give integers provenance and blow up the world. Remembering the difference between what is and what should be is important, most especially in Criminal Justice.

So as to not rag specifically on LLVM, here's a ticket with Martin in the comments where somebody blew up GNU's C compiler on essentially the same trick question:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119472


> If by "that's not true" you mean "that would be a bug in LLVM" then, uh, yeah, we know that it's a bug in LLVM.

No that's not what I meant. Of course there is a bug in LLVM, but I said there will be no miscompilations and meant that - because with strict provenance, we don't use the problematic constructs (that LLVM miscompiles).

> No, integers shouldn't have provenance. Due to this compiler bug unfortunately we can give integers provenance and blow up the world.

Nope that's incorrect. In LLVM (and all other compilers I know) integers do not have provenance, and there aren't any optimizations that think they do. The bug (as understood by experts) is in pointer handling and not integers, specifically that ptr2int is not treated as having side-effects and that int2pt is considered to give the same pointers for the same integers.


> Nope that's incorrect.

https://rust.godbolt.org/z/nxnazs7Y6

c and d are both integers. Do you agree?

When you follow this link they'll have arbitrary values so I can't predict what those values will be but I can tell you that they'll be identical because the optimising compiler put both those unused temporary locals in the same spot on the stack.

One and three are booleans which ask whether the pointers to those temporaries are the same, LLVM says they are not even though Rust's policy is that they are. That's not great, but we could choose to imagine that's a Rust bug, except...

Two is another boolean asking whether the integers c and d are the same. LLVM says that those aren't the same either. It has given provenance to integers, that's the bug.


Oh, it seems you're right. I wasn't aware of this. Interesting.

Perhaps. In C one should avoid any non-local use of one-after pointers and any integer-to-pointers casts. Then I think one is also safe from miscompilation. Alternatively, one can use a compiler that is not broken.

You definitely can be safe in C as well - the difference I noted is that in Rust the safe pattern is officially blessed and the unsafe pattern is officially unblessed.

That is fair, but we are a bit in a different situation. There are many C compilers, and we can not unbless language constructs every time one of them has implementation bugs. Perhaps would could this in this case, but compared to other issues compilers have, it is also a relatively minor issue in terms of practical impact on C code.

Also to be fair, it has to be said that officially blessed safe Rust code is not really what is competing with C.


Do you have a particular suggestion of a "not broken" C compiler? Genuinely interested.

No, not really. There are couple of smaller compiler projects such as tcc, slimcc, cparser, kefir, etc. that I kind of hope will mature a bit more, but I haven't really used them.

Sometimes I am wondering whether I should continue to develop my own compiler with an eye towards correctness, but I do not have enough time at the moment. And fixing bugs in GCC seems more useful.


> However in C, which most of the examples are written in, the status is a bit less clear.

I believe it's a bit of an exaggeration. Formally specifying int2ptr and ptr2int casts in a way that permits both all code found in the wild (or at least a large majority of it) and all optimizations compilers want to perform (ditto), is more than just a bit difficult.


I'm not a C expert, however I do follow Rust's discussions about pointer provenance. It might be unspecified but people do rely on this (e.g. pointer tagging is the same under your explanation), and even CHERI uses hacks to not break them, at least whenever possible. Furthermore the standard says in a footnote:

> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to be consistent with the addressing structure of the execution environment.

So even if it's not mandatory, it is expected to work.


Funny that this codebase is 62% Rust, 9% Python. And I'm a huge Rust proponent.

Why is that funny? He rewrote the slow 9% in Python.

Actually, Rust can have fully safe SIMD (Java too, but it's still in preview AFAIK).


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: