Pretty impressive performance. It seems web assembly is pretty good tech for writing a performant web app. Is there any benchmark comparing web assembly vs javascript? I mean the same logic executed by javascript code vs the web assembly.
Also curious to know if there are any serious web apps developed using web assembly.
Figma uses webassembly. We also use it for our web engine at https://castle.xyz, I gave at talk about that you can watch here: https://youtu.be/0FjCaoc1uzs where I go into some details and also do some live wasm game development (not sure how "serious" since we're still working on our app though).
Much, much better performance than JS is possible because (among many other things) you can perform a lot of optimizations during AOT compilation due to eg. LLVM, avoid GC and arrange memory to help cache efficiency.
Re: JS call overhead, ultimately using instanced drawing so you have a constant number of draw calls even for a growing number of objects is what helps.
Thank you! We also have a Discord server (link at bottom of website) -- the app is rough around the edges still and some support / inspiration usually helps.
I compared it casually with the original JavaScript implementation: in both Firefox and Chrome, both JS and WASM hit max FPS easily (165, in my case, incidentally). According to Firefox’s profiler, the JS version experiences noticeably more frequent jank; Chrome’s profiler doesn’t obviously show any jank for either. In Firefox, both are around 50% idle and there’s no obvious difference in their performance, though they definitely have different hot spots. In Chromium, indications suggest the WASM is being a few percent more efficient, spending 68–70% idle versus JS’s 65–66%; it spends much less time in scripting (~17% vs. ~22–23%), but more in rendering, painting and “system” (whatever that is) which make up the balance of that 100%.
These results are utterly unscientific. You also can’t compare Firefox and Chrome’s profiling numbers to one another.
I don't think you say much about the performance here except that it isn't noticeably terrible. Any modern computer should be expected to run this kind of thing with a smooth framerate using paltry resources. I would expect this even if this had been written directly in javascript.
My understanding is WASM is pretty performant except in the case when it needs to interact with browser apis / js where is preforms quite a bit worse than JS.
I recently discovered https://lekh.app which uses web assembly. I had a conversation with the developer and he told me that he is using web assembly for the core diagramming and shape recognition logic. The app is for diagramming and whiteboarding.
The whole diagramming and AI (to recognize shapes) is compiled into ~1M of web assembly.
I am the developer of https://lekh.app When I first experimented with the web assembly, it was kind of magic for me. I had a diagramming app called Lekh Diagram (https://lekh.app/diagram.html). The core logic was written in C++ and is being used in Android and iOS apps. I wanted to make a collaborative web version of the app. Initially I thought I would have to rewrite everything in Javascript. But when I first tried to compile all the c++ code into web assembly, it was around 4M of web assembly. And the performance was awesome. I was pretty satisfied with 4M. Then I started developing the Lekh Board (web version of the diagramming app). Later in the development phase, I realized there is a flag which I can pass to reduce the size further. Then I got the web assembly size ~1M.
Yet another great example proving google's bad customer support.
What is google trying to prove by such pathetic customer service? I have heard complain about almost every google service: admob, adsense, google app ....
I haven't had any experience with Google customer support, but here's an experiment. Go on Yelp, look up some highly-rated restaurants and shops in your area. You'll still find that many of them have one or two reviews about how terrible the service was, and how the product was awful, and the owner was a dick about providing a refund. Sometimes things go really wrong, and even the best will in the world can't fix it quickly. Only those stories make it to HN, because we all love a dogpile, and because people seem to have realized that bitching publicly is one of the best ways to get their problem solved quickest... although sometimes it's like faking a heart attack so you can see a doctor immediately, then asking him to take a look at a rash.
There's a big difference between a company providing bad service on one occasion, and a company actively blocking someone for days or weeks.
Don't imagine a restaurant providing the wrong food, burnt, and still charging full price. Imagine a restaurant taking the customer's iphone and keeping it in a safe for a month, employees ignoring them and telling them to leave. Are you really going to see many stories like that on Yelp?
Agreed. My biggest issue wasn't that an error occurred, but the fact that there was no recourse available in a timely manner. I tried to be patient and follow recommended support procedures (post to the forums, etc) but losing email for over a week because Google has an internal issue and couldn't be bothered to resolve it didn't sit well with me (thus the post to CTOVision).
nice article.. short article but addresses very important point.
The first quality in leader should be able to delegate the work and decision making processes
I think interfacing functional code from object-oriented code is usually pretty easy. You just wrap the functions to an object instance.
However, if your 'outer layer' is functional, and try to integrate OO pieces inside it, it can be troublesome to to wrap your OO code in such a way that it's natural to use in a functional context.
OO paradigm is in some sense more restricting, in that it limits the client of the code to using OO-like patterns.