Hacker News new | past | comments | ask | show | jobs | submit login

And by "the JS version", you mean the Java version—compiled to run in the browser by targeting its JS engine. There is no JavaScript version. This is a consistent mistake made throughout your article.

It's not an especially rigorous or intellectually honest article. It's a good example of how software development differs from other disciplines. The sleights of hand used in this piece are something that ideally would be rooted out in peer review.

You're comparing JVM bytecode as a compilation target for Java programs vs using JS as an alternative bytecode for Java programs. Unsurprisingly, the former wins. Who knew.




The primary point of the article is to compare two compilation targets for a single codebase: JS and WasmGC.

It's an extremely timely and interesting topic.

The performance of a third compilation target - JVM bytecode provides a useful baseline.


You just wrote out a series of true statements. But you aren't engaging with the comment that I wrote. <https://en.wikipedia.org/wiki/Grice's_maxims>

You're right: the article is comparing compilation targets for Java programs (or rather, one specific Java program in this case study). That's my point: despite that being what the article actually is, it's written like it's comparing Java programs to JS programs—the performance that a Java program can achieve versus the performance of a comparable JS program written to give the same results. But again, it's not comparing those. It's comparing how well they can compile Java, in Java source files, to JVM bytecode (or Wasm) and execute it on the corresponding VM versus how well they can get those Java source files to compile and run on v8 and various other JS runtimes. It's an analysis that simply doesn't show what is suggested by the authors' comments (e.g. "The challenge: JavaScript" and "Why is JavaScript slower than Java?" or anywhere that they refer to the (nonexistent) "JavaScript version").

Very sloppy and irresponsible use of language throughout. The whole article is a mess of confused thinking (at best, that is—the alternative is deliberate malfeasance).


I'd encourage you to take another look at the article because I don't think your criticisms are well founded.

The javascript version does exist! The fact that it's produced by a compiler doesn't undermine it's existence.

What's interesting here is not that it's slower than the equivalent running on the JVM but that it was _faster_ than a version compiled to wasm.

Well written and useful article if you would like to learn about what type of optimizations are effective in targeting the wasmgc runtime.


I have read it closely no fewer than three times. It's junk and filled with sleights of hand like I already mentioned, which you don't pick up on by not paying enough attention.


It's not a mistake.

The JS was converted to Java and at that time was _at worst_ 5% slower. This might be a shock to you that J2CL is actually good enough to get the same performance as hand-written JS but it's been measured.

There was a similar effort done where the Docs Android app began to run on Java instead of J2CL output and I guess you should be surprised to learn that it was actually slower and significant work had to be put in to make Java running in the JVM faster than that Java (via J2CL) running within a JSVM.


> It's not a mistake.

Then that's worse. Because it means that the misleading way the article is written is deliberate.

> This might be a shock to you that J2CL is actually good enough to get the same performance as hand-written JS but it's been measured.

This is such an obnoxious comment when it doesn't have to be, and it's orthogonal to the issue at hand—which is that a Java program compiled to one or more object files that are nevertheless ECMA262-compliant so that it can run on V8 is still a Java program, in the same way that a when you compile a Java program to JVM bytecode, it doesn't stop being a Java program.

There is no "the JavaScript version". There is only the Java version built for different compilation targets. It's not possible to frame it any other way and still be rigorously honest about the results presented here.

(And it's telling that nobody taking issue with my criticism here, and who have proferred a defense of the article that amounts to equivocation, is willing to defend the other passage that I called out that is exemplary of the { Confused XOR Dishonest } way that this article communicates its message. <https://news.ycombinator.com/item?id=40820423>)


I do wonder if you're intentionally being dense or just not reading the words people write. So I will make this incredible simple for you.

Google Sheets was released in 2006 and "Written in JavaScript" [1].

Around 2014 the codebase is mostly converted to Java. At this time the Java version and JS version's performance are measured and the Java version won't be allowed to launch if it's >5% slower across many use cases.

Note: The Java code isn't emulated by the browser. It's literally converted into a JS source file by GWT and your browser runs it just like any other JS file.

Note: This means the "Java" performance and "JavaScript" performance is equivalent.

Note: Rust is 2015 and full of lifetime markers [3] (i.e. not nearly as ergomatic as it is today); might even have green threads then too.

Around 2018 (?), GWT was replaced by J2CL. Similar story with performance rules.

Note: Not only is the file provided to your browser JS code, the JS file might contain handwritten JS source code for certain "Java files" as opposed to the J2CL output for that file.

Around 2023, J2CL is semi-replaced by WasmGC and WasmGC was 2x faster than the JavaScript being ran by the browser. That generated JS has a similar performance to completely handwritten JS so it's entirely honest to say WasmGC is 2x as fast as JS because

1. It is. It doesn't matter that the JS comes from transpiling Java files; open up a network tab and you'll see it's `.js` files.

2. Transitively it's better than the original handwritten JS files.

---

> And it's telling that nobody taking issue with my criticism here, and who have proferred a defense of the article that amounts to equivocation

No, it's just that you're using jargon to mean different things than other people use that jargon for and getting confused when things don't make sense in your state of the world.

It's a "JS version" because it's the version that is JS code. Much like how the output of J2ObjC produces the ObjC version.

[1]: https://en.wikipedia.org/wiki/Google_Sheets

[2]: https://en.wikipedia.org/wiki/Google_Web_Toolkit

[3]: https://en.wikipedia.org/wiki/Rust_(programming_language)


(Green threads were removed from Rust before 1.0)


A quick search brings up this RFC to remove green threads [1] which is dated "2014-09-16". So, it's entirely likely that Rust (sure, pre-1.0) had green threads around the time that the Java conversion happened.

Although the only important thing is that WebAssembly is 2015 [2] so there's pretty much no reason to convert to Rust to target WebAssembly when neither of them were actually released.

[1]: https://github.com/rust-lang/rfcs/blob/master/text/0230-remo...

[2]: https://en.wikipedia.org/wiki/WebAssembly#History


Yeah, to be clear, I'm not taking any position on what should have been ported. Just that you had indicated you weren't sure when green threads happened, and so I'd figure I'd chime in and let you know the details.

Super specifically, https://github.com/rust-lang/rust/pull/18967, on Nov 21, 2014, is when it was actually removed.




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

Search: