134 points · by zdw · 3y ago · 49 comments
That's a really indirect way, and it's not clear how much efficiency is lost in the process. It's not too far from claiming that $language can be used on a microcontroller, because $language exists on Linux, and the latter can run Linux even if via extremely slow emulation: https://news.ycombinator.com/item?id=19762928
Also related: https://news.ycombinator.com/item?id=22010159
https://kripken.github.io/blog/wasm/2020/07/27/wasmboxc.html
See also here, where wasm2c is the fastest wasm runtime:
https://00f.net/2023/01/04/webassembly-benchmark-2023/
There are of course cases that can be slower, like code that depends heavily on SIMD, as wasm support for SIMD is still being improved. But in general compiling to wasm as an intermediary IR and then using an optimizing compiler can lead to very fast code.
What I'm curious about is how hard it is to build a library target via this method and how much overhead there is in calling the generated code. Maybe someone who knows WebAssembly has some idea? Do call parameters need to get turned into JSON and back? Can I pass in a pointer to writable memory?
For memory access I can only describe how it works in the browser environment with Emscripten (for lack of experience with other WASM integrations): The WASM heap is exposed as a Javascript ArrayBuffer object (or more correctly that ArrayBuffer object is the WASM heap, created on the JS side and handed to the WASM side at startup), with per-primitive-type array views (for instance for byte access there's a global "HEAPU8: Uint8Array" object on the JS side).
Since WASM currently only has 32-bit pointers, pointers can be passed safely to the Javascript side as JS 'numbers' without loss of information. This 'number pointer' can then be used as array index to read and write data in the WASM heap from the JS side.
Don't know how it works in WASM engines outside the browser, but I suppose it's similar (e.g. a shared heap between the native side and WASM), except maybe that you can also pass 64-bit integers around without data loss.
But in no case there needs to be any JSON- or Protobuf-style 'parameter serialization' involved.
This old blog post might contain some more information: https://hacks.mozilla.org/2018/10/calls-between-javascript-a...
> Coremark 1.0: ~7% slower than native [0]
I wonder if I've been overthinking it. Surely, I could just compile Firefox or Chromium source to WASM, compile that with this tool, and then have a fully working browser! What could possibly go wrong?
Apple didn’t start calling it macOS until years after iOS was a thing and iOS was called OS X and iPhone OS first.
"OS X" was the official name for five years, from 2011-2016. It wasn't short for anything. The "Mac" prefix had been officially removed from it for that time.
This reminds me of when my grade school teacher kept trying to insist that my friend, named Alex, was actually named Alexander. I think he originally brought in a copy of his birth certificate to shut them up.
It's like how "Mac" is still short for "Macintosh", even though Apple basically never uses the full name anymore.
This is like telling someone who is called Louis that his actual name is Hlodowig.
[1] https://en.wikipedia.org/wiki/File:Mac_os_8_splash_screen.pn...
I was too young to remember, but do recall the Win 98/ME → XP upgrade being a huge headache, and was wondering whether people faced similar teething issues.
Everything since 10.5 Leopard (2007)
Maybe what I saw was about POSIX certification, but it's shockingly hard to find definitive info on that online. I can find the list of UNIX-certified operating systems, but not the list of POSIX-certified operating systems, at least not from an authoritative source. The latest version of macOS is POSIX-certified but I can't tell if there were any gaps between 10.5 and now.
Maybe the info I saw was total bogus.