Wczoraj odkryłem, że od niedawna Docker pozwala na odpalanie kontenerów WASM (obok tradycyjnych kontenerów inuksowych i mniej tradycyjnych windowsowych).
Główną zaletą jaką widzę jest to że kontener możemy zbudowac raz i na każdej platformie docelowej będzie on działał (obecnie trzeba budowac osobno na x86_64 i różne ARMy).
Czy poza tym są jakieś ciekawe zalety/wady/ciekawostki które dostrzegacie?
Obstawiam, że WASM będzie wypierał JavaScript całkowicie. I pewnie znajdzie swoje miejsce w serverless i jakiś systemach pluginów. Czy tak normalnie będzie używany do aplikacji to w sumie nie wiem.
Bo w tym przypadku to mała różnica jaki kontener odpalam, jak już i tak mam spakowaną appkę w kontener to z zewnątrz zarządza się tym praktycznie tak samo
I saw the announcement a couple of days back and it made sense to me: some sort of container-as-executable, for those people using docker containers for single (off the shelve) applications (e.g.: if you downloaded some compiler as a container, nice, now you can run it as “WASM app”).
But now that you made me think of it all; what does it actually do? Are you running the WASM inside a container? Does it compile a whole container into WASM (e.g. could I start a /bin/bash prompt in my WASM container?). If not, is it yet-another way to compile code once, run everywhere?
The idea is interesting, but really wondering which direction it’s going!
Over the past weeks I’ve been working on a video player in the browser, and I’m starting to realise that @DoomHammer 's idea (which I think was in this thread) about WASM becoming the new java (but then done right) is very close to where we get to. I’m very surprised to see:
How much you can do these days in a static webpage. My videoplayer is just some javascript (not even WASM) code hosted on S3, and you open it, and then open a video and play it (obviously with cool extra features :)). Everything stays 100% on your computer (so opening a 4GB video takes miliseconds), and you should be able to take the whole code and just run in from localhost (or probably a file:// url).
People are compiling crazy shit to WASM. For instance there is a WASM and a js compilation of ffmpeg and libav. You can convert from anything to anything (except h264 because of license shit) for free, on your own computer, and the guy hosting it needs just a static website. There are some problems with larger files since right now it seems to want to put the whole converted file into memory, but this is not something that cannot be worked around (which is my next project ;)).
There is a native file api these days in Chrome, meaning you can give both read and write access to specific files on your hard drive.
All this stuff was built on technology (browsers JS engines) that people have been trying to hack for decades – so it will be much more secure than the JVM. Also, permissions are given explicitly (e.g.: “select a file you want to write to”, rather than “is it OK if this applet gets root-access to your file-system y/n”).
I know that many applications are already distributed as electron apps, but usually this is to elevate permissions; as far as I see it, these apps can actually run in the browser with normal (as in: we don’t trust this app at all!) permissions.
I actually envision a future where, if I want to use ffmpeg, rather than brew install ffmpeg, I either go to the ffmpeg.app website and do stuff there, or use a cli runner that downloads and runs the code in a browser (i.e. in a very secure sandbox) with only access to those exact files that I want. It basically gives you the security of running shit in docker, but then fast and without needing difficult shit in windows/macos.