4 ms·
If this statement is true, there is no need for Docker, because JVM+JAR existed in 2008! Docker can do more than WASM or JVM+JAR: it can run non-WASM and non-JV
by pulse7 4y ago
If this statement is true, there is no need for Docker, because JVM+JAR existed in 2008! Docker can do more than WASM or JVM+JAR: it can run non-WASM and non-JVM apps like PostgreSQL, etc...
- nkozyra 4y agoMaybe I'm misunderstanding, but my thought was he was suggesting that the host/VM could be written in WASM, which could then run any arbitrary thing as Docker does today.
- krona 4y agoJNI? The JVM doesn't sandbox native code, nor can you target the JVM with (for example) GCC. So what are you referring to?
- zozbot234 4y agoWhy do you need JNI? You could just compile C-like code to run on the JVM using a byte[] array as the equivalent of memory. This is similar to how high-performance Java code is written already, to ensure that GC is completely out of the way. In fact GCC used to have a JVM target, called GCJ. It was removed due to lack of maintenance.
- imtringued 4y agoThat doesn't work. Java web apps have failed. Nobody uses Java in the browser anymore. So even if we use JVM bytecode as the intermediary language you would need to translate that into ASM.js and then you basically introduced arbitrary complexity for literally no reason and you won't have the performance benefit of webassembly. The browser engine developers effectively paid a huge up front fixed cost and now anyone can use Webassembly in nodejs which then spills over to more and more use cases like cryptocurrencies using a modified WASM VM for their zk sync layer two solution. The JVM simply wasn't built for these use cases.
- gpderetta 4y agowe are talking about server side applications though. I don't think anybody runs docker on the browser! A generic compilation target to the JVM would have worked, but it wasn't available 15 years ago, and GraalVM is mature about now, but so is WASM.
- krona 4y ago> You could just compile C-like code Which also involves rewriting literally everything to Java. > In fact GCC used to have a JVM target, called GCJ Which again, had a Java frontend. So, nothing like targeting WASM with C/C++/Rust.
- pjmlp 4y agoHere have fun, http://nestedvm.ibex.org/ http://nestedvm.ibex.org/
- deleted 4y ago[deleted]
- angelmm 4y agoDocker already have the community, tools and distribution layer. You can think as Wasm as another resource that can be run in Docker as it's today. You continue using the same tools with a new way of packaging and run applications / runtimes.
- ridruejo 4y ago"and non-JVM apps like PostgreSQL" PostgreSQL can (and has) been compiled to Wasm! It was on HN a couple of months ago https://news.ycombinator.com/item?id=33067962 https://news.ycombinator.com/item?id=33067962
- lucideer 4y ago> JVM+JAR existed JVM can only run apps written for it: Docker & WASM don't have that limitation. > it can run non-WASM and non-JVM apps like PostgreSQL, etc... but WASM can run Postgres
- pulse7 4y agoWith GraalVM you can run any LLVM binary on JVM...
- lucideer 4y agoThat is true, graal's certainly more readily comparable.
- ZitchDog 4y agoSource?
- TobTobXX 4y agohttps://lmddgtfy.net/?q=postgres%20wasm https://lmddgtfy.net/?q=postgres%20wasm
- angelmm 4y agoHere you have the different links: - Article: https://supabase.com/blog/postgres-wasm https://supabase.com/blog/postgres-wasm - Repository: https://github.com/snaplet/postgres-wasm https://github.com/snaplet/postgres-wasm - HN Thread: https://news.ycombinator.com/item?id=33067962 https://news.ycombinator.com/item?id=33067962
- lucideer 4y agoas well as the sibling linked repo there's also https://www.crunchydata.com/developers/playground https://www.crunchydata.com/developers/playground
- pjmlp 4y agoC and C++ compiler for the JVM from 2006, http://nestedvm.ibex.org/ http://nestedvm.ibex.org/
- batmansmk 4y agoYou can compile any C / C++ app down to wasm. In fact that’s the raison d’être of the technology: to provide a portable safe way to run binaries. Here is a link to Postgres in wasm for instance: https://supabase.com/blog/postgres-wasm https://supabase.com/blog/postgres-wasm. The way it works is that instead of outputting assembly for a given architecture in the backend compiler, it outputs wasm instructions that are designed to map all architectures, not like the jvm which is designed primarily for Java in the front end.
- mytherin 4y agoC/C++ code can certainly be compiled down to WASM, but you cannot interface with the operating system as you would in a normal C/C++ program. To get around that restriction postgres-wasm ships an entire Linux distribution that is run inside the browser. This comes with an immense performance penalty. To get an impression of the performance penalty, just run the following query: SELECT SUM(i) FROM generate_series(0, 1000000, 1) tbl(i); This simple query completes in 100ms locally on my laptop, but takes 17265ms in postgres-wasm. That is a slowdown of 170x. Now that is not WASM's fault - when running the same query in duckdb-wasm [1] on my laptop the query takes 10ms using WASM, and 5ms when run locally, with a slow-down of only a factor of 2. But in order to achieve those results we did have to adapt the DuckDB codebase to compile natively to WASM. That is absolutely possible but it does take engineering effort - particularly when it comes to larger older projects that are not designed from the ground up with this in mind. [1] https://shell.duckdb.org https://shell.duckdb.org
- riddleronroof 4y agoThank you for these details. Always suspected these claims but hadn’t dug deep enough. Seems like some X can now run in wasm should come with disclaimer (includes Linux)
- pjmlp 4y agoHere, have your C and C++ compiler for JVM bytecode from 2006. http://nestedvm.ibex.org/ http://nestedvm.ibex.org/
- 4y ago