Measuring the overhead of WebAssembly using libsodium
00f.net
00f.net
I understand the reasoning of the author, still it would have been nice to have a comparison with non-SIMD native code for those of us who don't keep track of how much the SIMD buys you these day for crypto.
> On a surprising number of tests, Cranelift’s optimizations produced slightly slower code than with optimizations disabled.
So how much of this result is WASM and how much is Cranelift? By the sound of it, Cranelift doesn't produce very optimal output yet, so should still be potential for significant gains, no?
Faster than any one application needs. But virtually anything I do nowadays uses crypto on some level, and wasm isn't only proposed to be used for crypto either. Suddenly, my CPU has to do 2x to 7x the work for the same code, because we collectively decided that using electron and web stuff if the way to go for nearly every mainstream application? I don't think so, really.
WASM seems to me like some people are simply longing for the old days of flash. I don't see why I'd want it.
In what way is WASM like Flash? One is a proprietary IDE with a VM to run it and the other is an open bytecode standard.
1) increases the attack-surface[0] of the browser (arbitrary code execution in victims browser)
2) wasm shares some of the same vulnerability classes from native applications (thanks to code generation frameworks that allows you to spit out wasm in addition to say C - see Nim & others offering generation via llvm backend)
3) cryptographic verification of payloads is still not possible (afaik)
4) binary blobs from untrusted sources which isn't auditable in the way javascript is (raises the bar for security researchers to identify malicious payload, or really just anyone who want's to audit / poke around)
5) thanks to 1+2 wasm shares the same pitfalls as JavaScript when doing crypto in the browser.
6) all of the above works over plain HTTP links (hurray)
7) assumes that security/integrity can be derived from language subsets and a few rules to prevent specific type of behavior[1]
[0] https://i.blackhat.com/us-18/Thu-August-9/us-18-Lukasiewicz-...
[1] https://webassembly.org/docs/security/
[2] https://nvd.nist.gov/vuln/search/results?form_type=Basic&res...
edit: link to current CVE's
Those CVEs mostly look like problems in the sandbox, which will mature as WASM gets used more. Those types of things point to immaturity in implementation, not design AFAICT.
EDIT: just to support my claim, here is an example of a WASM runtime implementations that run 4x-6x faster than others: https://github.com/perlin-network/life#benchmarks
I've been wanting to use it for some b2b applications, or maybe for some reports/charts. Just in places where it makes sense to need that power, but you'd want it in a browser.
Unreal and Unity web builds are not production-ready yet. The cross compilation can be brittle, compile time is huge, the resulting assemblies are large and memory consumption is just too high.
This leads to many, many problems, which are hard to diagnose. Getting games to work on mobile browsers consistently is nearly impossible. For example, last time I checked, Chrome on Android disables WebGL by default and limits memory to 64mb.
Unity is working on "Unity Tiny", but it's in alpha state. Frameworks like Three.js are better suited, but more barebones. Still a long way to go...
"Stage3D - The Demo of Porting Epics Unreal Engine to Flash"
It lets web devs use languages other than JS on the frontend. That's primarily why I'm excited about it.
As for why electron, the only real explanation I've heard from people that makes sense is the ease with which you can put together custom UI controls and style them. All of the desktop UI systems are great at the simple things, like putting default OS controls in an app, but complex things like creating custom controls, animations and complex styling appear extremely difficult to accomplish. At least, that's the way it seems to me.
QtQuick, at first glance, is weird. It uses JS and the animation transitions look pretty close to css transitions.
I guess what I'm looking for here is: how is it a clear win over electron other than just raw speed?
Maybe I'll make a non-simple app in both electron and QtQuick and see how they compare in terms of ease of development, development speed, app size, ram usage and "speed".
https://github.com/qmlnet/qmlnet
I used it at work on my embedded devices.
https://medxchange.com/4klear-all-in-one-camera-recorder/
I highly recommend it. PS: I'm the author.
The usual pattern:
1. Instead of figuring out how to do things well in the native space, developers hack something together from web technologies, because it's "simpler".
2. They realize it doesn't work all that well and reinvent some aspect of native environment to fill the gaps.
3. They backport all the complexity back to the web, because they want to run one codebase everywhere.
This is incredibly backwards. We get bloated faux-native apps that use abstractions that make zero sense outside of the web context. We get web technologies that are bad approximations of what has been done reasonably well in the native space. Finally, we get more and more complexity with each iteration.
---
BTW, does anyone remember how Alan Kay said[1] browsers should be designed to be like mini operating systems? Does anyone remember how many people said he is wrong and doesn't understand the web? Well, browsers increasingly are used as an operating system, except it's a system formed by accretion, not by deliberate design. So maybe, just maybe, people should pause, listen to Kay and read up on how similar problems were solved by very smart people before us, instead of just adding more and more web-ducktape to everything.
What we really need to settle this, is a cross-platform UI framework that compiles to native UI and code on each OS/hardware.
Not a rhetoric question, because the answer is what needs to be fixed.
One of the reasons is the fact that they're written in C++ and not C, therefor difficult to wrap natively by host languages.
At least, that's my main gripe as someone who doesn't want to touch C++.
And honestly, I think in the end, virtually any such tool will, because to really get the fine nuances and details right, the programmer simply must be aware of them, no automation will do this for you. On macOS, even Apple's own attempt on this ("Marzipan", which allows to generate iOS and macOS apps from a single codebase) suffers from this, although admittedly one may hope that at least in principle this framework could eventually really provide a 100% native experience, provided the people using it are aware if the idiosyncrasies of macOS (and conversely, iOS).
And that's for a tool trying to provide a common API for two UIs, with all three products developed by the same company. It gets much tougher once you also try to get Linux and Windows supported...
I've tried many frameworks that promised to this in the past 20 years, both as developer and user. All overpromised and underdelivered. Qt and wxWindows included. I actually prefer Atom (electron based) over any wxWindows or Qt software I ever tried - though this probably is primarily because somebody tried hard to polish its UI. While (I am guessing) most people who are content with what Qt and Wx deliver won't even notice the need to polish (those who do care eventually realize it is hopeless, and move on).
But that's not what app developers are looking for. They want to be able to throw something together and have it just work and look as intended on any platform.
Ease of getting started is in my opinion among the 3 most important factors for developer adoption of a technology.
The c source code is really excellent[1]. It's worth browsing!
[0]-https://github.com/jedisct1/libsodium.js [1]-https://github.com/jedisct1/libsodium/tree/master/src/libsod...