Google Sheets ported its calculation worker from JavaScript to WasmGC
web.dev
web.dev
Edit: In a different blog post :
https://workspace.google.com/blog/sheets/new-innovations-in-...
"Building on improvements like smooth scrolling and expanded cell limits in Sheets, today we’re announcing that we’ve doubled the speed of calculation in Sheets on Google Chrome and Microsoft Edge browsers,"...
I dont use Google Sheet but I wonder how far apart are their new implementation compared to Native Microsoft Excel.
The idea of incremental calculation of formulas that don’t need to be put in a particular order is still genius but the grid is so Apple ][. Maybe the world doesn’t know it because it spurned XBRL but accounting is fundamentally hyper dimensional (sales of items > $100 in the afternoon on the third week of February in stores in neighborhoods that have > 20% black people broken down but department…) not 2-d or 3-d.
Having the wrong data structures is another form of “garbage in garbage out”. I have though many times about Excel-killers, trouble is they have to be something new, different and probably specialized, people know how to get answers with Excel even if they are wrong, plus Excel is bundled with the less offensive Word and Powerpoint so a lot of people are paying for it either way.
Personally I want a spreadsheet that does decimal math even if there is no hardware support except on mainframes: I think a lot of people see 0.1 + 0.2 |= 0.3 and decide computers aren’t for them.
Displays 0.3:
"=0.1+0.2"
Displays 3E+79:
"=(0.1+0.2)*1e80"
This question suggests it uses floats: https://stackoverflow.com/questions/74542790/google-sheet-yi...
I live in excel sadly and it's all been downhill since excel 2003
as for better math calcs, yeah excel isn't perfect for true accuracy of decimal math but that rarely matters in 99.99% of use cases - if you need really accurate math you use R/Python/etc.
if you need something for the masses, visicalc/lotus/excel is the solution
I was involved in this work (happy to answer any questions). Overall we started from a large slowdown compared to JS, worked hard, and ended up with a large speedup over JS of around 2x. So right now it is a big improvement over JS.
That improvement required work across the codebase, the toolchain, and the VM. Most of it is not specific to Java and also helps other WasmGC projects too (like Dart and Kotlin). We are also working on further improvements right now that should make things even faster.
I'm interested more in learning how to work within wasmgc. Do you have any resources you'd point to for someone looking to pick it up?
https://v8.dev/blog/wasm-gc-porting
See in particular the "getting started" section near the end:
https://v8.dev/blog/wasm-gc-porting#getting-started
At a lower level the overview in the WasmGC github repo is very good:
https://github.com/WebAssembly/gc/blob/main/proposals/gc/Ove...
(I remember you from your work with asm and emscripten and the various ports you did, which I played around with)
No specific question(right now), I just want to say, I admire your work.
Yeah, I was involved here on the toolchain side. We did a lot of work on the Binaryen optimizer for WasmGC.
1. How is the landscape of wasmGC browser support? Given it's relatively new is it OK to use this and ship production apps now? How does sheets handle older/unsupported browsers?
2. In Google IO the Workspace team mentioned they'd leverage Kotlin Multiplatform to achieve use cases like this. I see Sheet's using the in-house J2CL compiler but is there cases where KMM is used to target WASM - in sheets or docs? What are your thoughts?
https://webassembly.org/features/
Chrome (and other Chromium-based browsers) and Firefox have had WasmGC enabled for a few releases now. But Safari doesn't yet last I heard.
Sheets can serve a JS version to browsers without WasmGC, since they can compile the same code to either JS or Wasm.
About Kotlin, I know they have a working WasmGC toolchain that works very well, so personally I think it is a good option in general. But I don't know offhand about current users or plans.
I'll add that browser Google Sheets and native Microsoft Excel are the fastest versions available (of each product).
But yes I'd be curious to see how the web version of Excel does it.
While you technically can run it on ChromeOS through the Android emulation, it's still a mobile app and you're far better off running the web version.
Yet excel still limits the number of rows to 65536 or so.
Even a million seems embarrassingly puny these days, considering a webpage can have a million checkboxes rendered in only a moment.
> When disagreeing, please reply to the argument instead of calling names. "That is idiotic; 1 + 1 is 2, not 3" can be shortened to "1 + 1 is 2, not 3."
Any serious Excel user has a PC.
One of the few places remaining where Windows > Mac
And Microsoft would rather push everyone to the 365 Web subscription, than keeping selling native Excel, which by the way, nowadays uses plenty of React Native code instead of pure C++, exactly because of code portability to Office 365.
https://github.com/google/j2cl/
And that now includes a Java to WasmGC compiler, called J2Wasm:
https://github.com/google/j2cl/blob/master/docs/getting-star...
They only made these changes yesterday.
"For example, they had a core data structure in Sheets which was blurring the lines between arrays and maps. This is efficient in JavaScript, which automatically models sparse arrays as maps, but slow on other platforms. ""
"Of the optimizations they found, a few categories emerged:
Replicating core optimizations that already existed in the Java Virtual Machine (JVM) and in V8.
Using highly optimized browser APIs.
Removing JavaScript-specific coding patterns"
Basically it seems, they tried to copy their js code. And this unsurprisingly did not work out well. They had to reimplement some critical parts.For example, they point out that they got 40% improvement by adding devirtualization to the compiler. Java by its nature likes to add a whole bunch of virtual method calls. Java devs primarily rely on the JIT to fix that up (and it works pretty well). Javascript relies similarly on that sort of optimization.
WASM, on the other hand, was built first to compile C/C++/Rust code which frequently avoids (or compiles away when it can) virtual method calls.
I imagine this isn't the only issue. For example, I'll guess that dealing with boxing/unboxing of things also introduces a headache that wouldn't be present in similar C/C++ code.
In short, it just so happens that a lot of the optimizations which benefit JS also benefit Java. The one example where they did a Javascript optimization was prefering Maps and Lists over PoJos.
We had a pretty awesome team of people working across the entire stack optimizing absolutely everything. The blog post only talks about the three optimizations that made the biggest difference.
Go also has a WASM target which runs pretty slow compared to its native binaries. GC extensions might help but as far as I can remember, Go's memory model does not fit the WasmGC so it might never be implemented.
now explain if it's higher performance of JS or WAT
https://web.dev/case-studies/google-sheets-wasmgc#the_final_...
> The final result
> After all these optimizations, the final WasmGC version of Sheets achieves a calculation performance approximately twice as fast as JavaScript, representing a fourfold improvement from the starting point of the initial WasmGC version.
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.
It's an extremely timely and interesting topic.
The performance of a third compilation target - JVM bytecode provides a useful baseline.
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).
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.
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.
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>)
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)
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...
Super specifically, https://github.com/rust-lang/rust/pull/18967, on Nov 21, 2014, is when it was actually removed.
https://developer.chrome.com/blog/wasmgc/
Some things that are at first glance surprising is that GC'ed languages might ship a smaller binary, because they don't need to include the code that manages memory. (The example here was Java.)
When WasmGC is widely adopted, we might hopefully see some languages adopting it as a target instead of JS. I'm thinking of Clojure and Dart specifically but there are plenty of other languages that might benefit here.
This could also have an impact on "edge computing" (isolates etc.) down the line.
Languages like Kotlin, Scala, and OCaml also target Wasm GC now.
Edit:
I'm not familiar with scheme/guile (only dabbled with Racket and later Clojure).
Are these real bytes that behave like actual bytes when you manipulate their bits (unlike Java etc.) and are stored as actual bytes?
https://www.gnu.org/software/guile/manual/html_node/Bytevect...
golang on the back-end - golang in the browser.
https://github.com/google/j2cl
Java everywhere.
Also j2objc
https://github.com/google/j2objc
Write the logic in java and get it on iOS, web and android.
Is this a case of worse-is-better? I think so.
A huge value prop for early (pre-1.5) Java was sandboxing, but it ended up being clunky, frustrating, and too slow for the browsers / dial-up modems of the era and lost its chance to be the sandbox of choice - leaving the door open for Javascript to win as the world's most widely deployed sandbox.
While I look forward to being able to use things other than Javascript or languages seriously confined to Javascript's basic semantics in the frontend, I expect Go to be a laggard because it's going to be hard to get it to not generate relatively large "executables". I expect other languages to be the "winners" in the not-JS-frontend race.
Probably one of the more interesting things in that ecosystem is the multiplatform compose framework. This allows you to target IOS, Android, Desktop, and browsers via wasm with the same code base. I expect it will be a good 1-2 years before most of this goes mainstream. It's still early. IOS support is still in beta. But things are looking pretty promising at this point.
Worth a mention in this context because Google just endorsed Kotlin multiplatform in a big way at their latest Google IO. They were also on stage at Kotlinconf last month. And of course they originally developed Jetpack Compose for Android, which this stuff is building on.
Interesting that they developed their own compiler instead of porting the codebase to Kotlin and building on this, which is a fairly common thing to do with legacy Java code these days. Kotlin is becoming quite popular across Google's Java teams apparently. Same at Facebook and AWS.
https://workspace.google.com/blog/sheets/new-innovations-in-...
"Building on improvements like smooth scrolling and expanded cell limits in Sheets, today we’re announcing that we’ve doubled the speed of calculation in Sheets on Google Chrome and Microsoft Edge browsers,"...
I assume this is 2x the speed of their current JavaScript code.
The good news is that most of those optimizations weren't specific to Java, like work in V8 (that helps any Chromium-based-browser running WasmGC) and work in Binaryen (that helps any Binaryen-using toolchain, like Kotlin and Dart).
I'm bothered by the sluggishness of the UI, but I've never typed '=A1+A2' in a box and found it takes too long to get an answer.
Even if it did, I'd kinda like million row X million column sheets to somehow be server side and my machine simply views a local window, and calculations happen locally if feasible with locally available data, or server side otherwise.
Nobody expects a Google search to involve the client crawling the whole web and picking out your search keywords...
It's more of an issue when you have a few 100k lines and lots of layers of different lookups etc.
I don't need to do a lot of MMO spreadsheets though, so I generally try to use Apache OpenLibreOffice.org locally, and it never stalls because of client-server communication.
Tens of thousands can be, depending on what you are doing, if there is VLOOKUP, etc.
The sheet: https://docs.google.com/spreadsheets/d/1QGrMm6XSGWBVLI8I_DOA...?
A video tutorial to use the sheet: https://www.youtube.com/watch?v=CClhsaBbTm0
> be server side and my machine simply views a local window, and calculations happen locally if feasible with locally available data
I assume this is what is happening? The client tries to recompute the data locally. But bails out on cells where it is missing input data. Then the server responds with an authoritative copy of visible data that the client applies over top of its guesses.
[0] https://github.com/WebAssembly/shared-everything-threads/blo...
For example, isn't CPython a C program and hence can just be compiled to Wasm, including its garbage collection part? Does garbage collection usually depend on OS specific calls, which are not part of C standard?
* Significantly increased binary size
* No easy way to trace heap objects shared amongst many modules
* Efficient GC needs parallelism, currently limited in Wasm
For a more thorough explanation, see https://wingolog.org/archives/2023/03/20/a-world-to-win-weba...
The idea of WasmGC is to make objects which are available in the browser environment (like window) available in the wasm module. It is a spec which allows you to pass objects which are actually managed by the browsers GC to your wasm code.
> Managed languages do not fit the model of "linear" Wasm with memories residing in one ArrayBuffer. In order to enable such functionality, they need to ship their own runtime which has several drawbacks: (1) it substantially increases binary size of these modules and (2) it's unable to properly deal with links crossing the boundary between the module, other modules and the embedder that all implement their own GC who is not aware of the others.
> WasmGC aims at providing a managed heap that Wasm modules can use to store their own data models while all garbage collection is handled by the embedder.
Reference counting does not handle circular references, and tracing does
Tracing collectors have to be able to read all the references of objects to work. The difficulty is that some of those objects or references to objects are in the stack - or in simpler terms, these are objects and references that only one function can read and understand. In C there are some non-standard extensions that let you do this to varying degree of success. In WASM, this is prohibited by design, because it’s a safety issue
https://news.ycombinator.com/item?id=29019992
One thing that's amazing about SqueakJS (and one reason this VM inside another VM runs so fast) is the way Vanessa Freudenberg elegantly and efficiently created a hybrid Smalltalk garbage collector that works with the JavaScript garbage collector.
SqueakJS: A Modern and Practical Smalltalk That Runs in Any Browser
http://www.freudenbergs.de/bert/publications/Freudenberg-201...
>The fact that SqueakJS represents Squeak objects as plain JavaScript objects and integrates with the JavaScript garbage collection (GC) allows existing JavaScript code to interact with Squeak objects. This has proven useful during development as we could re-use existing JavaScript tools to inspect and manipulate Squeak objects as they appear in the VM. This means that SqueakJS is not only a “Squeak in the browser”, but also that it provides practical support for using Smalltalk in a JavaScript environment.
>[...] a hybrid garbage collection scheme to allow Squeak object enumeration without a dedicated object table, while delegating as much work as possible to the JavaScript GC, [...]
>2.3 Cleaning up Garbage
>Many core functions in Squeak depend on the ability to enumerate objects of a specific class using the firstInstance and nextInstance primitive methods. In Squeak, this is easily implemented since all objects are contiguous in memory, so one can simply scan from the beginning and return the next available instance. This is not possible in a hosted implementation where the host does not provide enumeration, as is the case for Java and JavaScript. Potato used a weak-key object table to keep track of objects to enumerate them. Other implementations, like the R/SqueakVM, use the host garbage collector to trigger a full GC and yield all objects of a certain type. These are then temporarily kept in a list for enumeration. In JavaScript, neither weak references, nor access to the GC is generally available, so neither option was possible for SqueakJS. Instead, we designed a hybrid GC scheme that provides enumeration while not requiring weak pointer support, and still retaining the benefit of the native host GC.
>SqueakJS manages objects in an old and new space, akin to a semi-space GC. When an image is loaded, all objects are created in the old space. Because an image is just a snapshot of the object memory when it was saved, all objects are consecutive in the image. When we convert them into JavaScript objects, we create a linked list of all objects. This means, that as long as an object is in the SqueakJS old-space, it cannot be garbage collected by the JavaScript VM. New objects are created in a virtual new space. However, this space does not really exist for the SqueakJS VM, because it simply consists of Squeak objects that are not part of the old-space linked list. New objects that are dereferenced are simply collected by the JavaScript GC.
>When full GC is triggered in SqueakJS (for example because the nextInstance primitive has been called on an object that does not have a next link) a two-phase collection is started. In the first pass, any new objects that are referenced from surviving objects are added to the end of the linked list, and thus become part of the old space. In a second pass, any objects that are already in the linked list, but were not referenced from surviving objects are removed from the list, and thus become eligible for ordinary JavaScript GC. Note also, that we append objects to the old list in the order of their creation, simply by ordering them by their object identifiers (IDs). In Squeak, these are the memory offsets of the object. To be able to save images that can again be opened with the standard Squeak VM, we generate object IDs that correspond to the offset the object would have in an image. This way, we can serialize our old object space and thus save binary compatible Squeak images from SqueakJS.
>To implement Squeak’s weak references, a similar scheme can be employed: any weak container is simply added to a special list of root objects that do not let their references survive. If, during a full GC, a Squeak object is found to be only referenced from one of those weak roots, that reference is removed, and the Squeak object is again garbage collected by the JavaScript GC.
WasmGC is useful for many other projects of course. But I wonder how painful it is to maintain a Java code base, which is not a great choice for client-side web apps to begin with. I remember using GWT back in the days - and that never felt like a good fit. GWT supported a whitelisted subset of the Java standard library. But the emitted Javascript code was nigh on impossible read. I don’t remember if Chrome’s developer tools already had source map support back in those days. But I doubt it. Other core Java concepts like class loaders are equally unsuited for JavaScript. Not to mention that primitive data types are different in Java and JavaScript. The same is true for collections, where many popular Java classes do not have direct counterparts in JavaScript.
But I do agree Java has downsides. A more practical conversion would be to Kotlin. That's a much closer language to Java, and it can interop, which means you can rewrite it incrementally, like adopting TypeScript in a JavaScript project. Also, Kotlin uses WasmGC, which avoids the downsides of linear memory - it can use the browser's memory management instead of shipping its own, etc., which is an improvement over C++ and Rust.
>The initial version of Sheets Wasm showed calculation performance roughly two times slower than JavaScript.
>[...]
>Implementing speculative inlining and devirtualization—two very common optimizations—sped up calculation time by roughly 40% in Chrome.
So the only numbers we get are 2x slowdown and the 1.4x speedup, which makes it sound like it's still slower. I'm sure thats probably not the case but it is a strange way to write an article advertising wasm.
Also, I'm a bit confused about which language this was actually written in before the wasm switch. Was it always written in Java and transpiled to JS? It doesn't seem that way from the article:
>Removing JavaScript-specific coding patterns.
>they had a core data structure in Sheets which was blurring the lines between arrays and maps. This is efficient in JavaScript
which doesn't make sense if they were writing it in Java and transpiling to JS.
Was it transpiled to JS only once in 2013 and then developed in JS from there? In which case why go back to Java?
They are right though that wasmgc might have a bigger impact than wasm alone. Lots of attention is deservedly paid to Rust but people use garbage collected languages more.
Presumably they think this investment will pay off in various ways like ensuring Chrome has a good implementation of WasmGC and building expertise and tools for using WasmGC in other Google products.
I would not mind a perf boost.
Has anyone rewritten a performant calculation in that way from JavaScript to WASM? I’m curious to what the performant gap is, and whether browser optimizations are closing or widening that gap.
WebGL | WebGPU + WasmGC => Flash!
Thanks Google.
PS: I think it's basically ancient wisdom at this point to keep a Chrome instance around to best handle most Google properties, but I don't remember seeing it much spelled out in official documentation.
Lots of office suites exist, but Microsoft has to tread lightly. In Recent News, the EU is dinging them for bundling/tying Teams with Office. Because it's a dominant market position, regardless of competitors.
If at some future time, Google Sheets has a significant market share, they might get dinged, too.
We're talking about 4 or 5 browsers, putting serious effort into supporting them all would be reasonable.
Building a Firefox extension would be the right move.
[0]: https://docs.webkit.org/Other/Contributor%20Meetings/Slides2... [1]: https://bugs.webkit.org/show_bug.cgi?id=247394
"All Wasm GC features are implemented, and the feature can be enabled once typed funcrefs (https://bugs.webkit.org/show_bug.cgi?id=272003) are enabled"
Uh, that's a terrible example. It's not an example of anyone forced to "bend their whole application to the idiosyncrasies of JS" at all. It's almost the opposite
Someone wrote the code they wanted to write, whether in good taste or not, and the JS runtimes that the product was tested on handled it efficiently (to their credit!); i.e., the authors of those JS runtimes had to bend their implementations to accommodate the idiosyncrasies of people who were/are writing code like that.
I can only assume "old" pages are down-ranked more by Google than those with no date at all.
Maybe the content date is in a metadata tag somewhere, I've not bothered to check yet. But if it is why not make it visible on the page as well?
Located at the bottom of the page.
Typically if a page is no longer relevant but recently updated (like this page was), it would be denoted as such right up top.
They could have rebuilt the page with a new template or something. knowing the original pub date is kind of important for placing the decision in context.
Which isn’t helpful if you’re a person who doesn’t want to read old posts.
What qualifies as a major change can be subjective at times: there have been controversies where newspapers change an inaccurate headline without notice and larger controversies where there is a "stealth edit" that many readers believe should have been publicized. But this expectation that there should be transparency with edits should be the norm.
I believe that articles on personal websites and blogs can only gain by following the practice, too, as it's an indicator to the reader that the author cares about transparency and accuracy.
It's been used in place of applets a lot, but mostly because you could provide a complex application that opened in a new window with a click (assuming you dealt with the CA shenanigans).
It couldn't interact with DOM unless it accessed a browser over something like COM.
It's based on CheerpJ, a JVM that runs in the browser (using JS and Wasm).
Even in the heydays of Java, desktop applications were never all that great. I remember how painfully slow Eclipse ran. And when I tried the WebStorm IDE a few years back, all the same problems still existed re memory management and some pronounced latency pressing a key and having the character appear on screen. WebStorm was also infamous for its code indexing runs, which pretty much froze my computer for a number of minutes. Not sure if that’s a Java problem though.
People criticise Electron, but honestly: applications like Slack, Spotify and VS Code run much better than the Java-based desktop apps that I got to use.
uhhhh I don't think there is actually a real answer in that paragraph that compares PERFORMANCE of JS to JAVA.
that explanation is completely unhinged?
JavaScript plays fast and loose with types. Which means that when JIT compilers generate code for it, they have to make all sorts of conservative decisions. This makes generated code more complex and, in turn, slower.
Does that make sense?
But for all intents and purposes, WebAssembly is now on par (and beyond) what Portable Native Client supported. Some things were easier in PNaCl - threading support comes to mind.
There used to be a SIMD.js proposal, which was AFAIK abandoned in favor of WebAssembly SIMD. Google’s proprietary Native Client also added limited SIMD support as its last hooray.
I personally think the way to go is to improve the interoperability between JavaScript and WebAssembly instead of continuing to pursue low-level pattern like asm.js and SIMD in JavaScript. And let’s face it. For any larger code base, JavaScript is a mere deployment format, not the language you code your project in. I am still hoping for a future version of Typescript that can compile into WebAssembly.