Announcement

Collapse
No announcement yet.

Miguel de Icaza Talks Up WebAssembly Greatness

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by cjcox View Post

    It's just so weird how we've gone from "allow everything" to "allow nothing" (user controlled) back to "allow everything" again.
    What do you mean? How is downloading WASM IR any more dangerous than downloading JS?

    Originally posted by Michael_S View Post
    As far as I understand it - and correct me if I'm wrong - the JVM does stack allocations just fine, it handles primitives well in terms of efficiency but (as you said) the syntax for working with them is terrible, and the biggest bit of memory overhead is loading the whole standard library at startup. So if you write code to work with, say, a list of integers in Java you could match .NET or even C++ for speed with the right syntax but the default option is List<Integer> which is far less memory and CPU efficient.
    Since Java9, the whole thing is modularized and you can make your own runtime including only what you need. Of course, we're approaching Java14 and the module system still hasn't caught on. But it's there.
    Last edited by bug77; 03-04-2020, 05:27 AM.

    Comment


    • #32
      I went to https://wasmer.io/ the page rendered. I scrolled down and the page rerendered with "An unexpected error has occurred."

      Comment


      • #33
        Originally posted by bug77 View Post
        Since Java9, the whole thing is modularized and you can make your own runtime including only what you need. Of course, we're approaching Java14 and the module system still hasn't caught on. But it's there.
        There is also GraalVM which lets you compile to a native binary and only includes the bits of the standard library that your program uses. But you can't use certain Java APIs, especially Reflection, and for long-running processes GraalVM is slower than the standard JVM because it doesn't have the full JIT optimization engine.

        Comment


        • #34
          Originally posted by Luke_Wolf View Post
          So if it's a primitive type it's loaded on the stack, if it's a class type it's loaded on the heap. So already we start out with some caveats where "fine" means "only works with primitive types." whereas .NET, Rust, and C++ do not have this limitation.

          In .NET anything that's a value type, which includes both primitive types and user defined types that are declared as structs and must follow certain rules (which in principle allows value types to be CoW internally) is stack allocated and is handled with pass by value semantics, whereas anything that is a reference type (denoted by the class keyword) is allocated on the heap and follows pass by reference semantics. This covers most actual use cases, (and if CoW is done then can arguably be faster and more efficient than normal stack allocation).

          In C, C++, or Rust you can declare any type as stack or heap allocated.

          I'm not versed enough on other languages/runtimes to comment on their inner workings in this regard.
          Thanks for the explanation. Java 14 has in preview 'Record' types, which are similar in some respects to structs. But I read the documentation and I don't think Java Records are stack-allocated.

          Comment


          • #35
            Originally posted by bug77 View Post

            This adds complications of its own. You no longer have a single WASM file, you now have to manage the runtime and your code separately. And then what do you do if the compiler smartens up and doesn't include the whole runtime, but just the parts you actually use? How many runtimes do you keep around (I'm looking at you, Windows with a bazillion MSVC runtimes that no one dares touch).
            Managing the code and the runtime separately would be a benefit, it keeps separate things separate, the code just have a reference to the runtime with the version it desires.
            If there is a higher version of the runtime, then it uses that and it should be backwards compatible.
            Like your code declares "using [email protected]" but it also runs on systems with Python 3.8.2 installed.

            Comment


            • #36
              WebAssembly is cancer.
              I don't want to run "apps" while I'm browsing. I want to read/watch contents.

              You must be a retarded fuckboi to think that WA is a good idea.

              Comment


              • #37
                From the front page of the Wasmer site:

                Code:
                curl https://get.wasmer.io -sSfL | sh
                Who actually runs these pipe curl output to sh snippets?!

                I don't think I'd even use that command in a VM; if not because of VM escape bugs, then because I wouldn't even be sure of what commands were executed.

                Comment


                • #38
                  Originally posted by Michael_S View Post

                  There is also GraalVM which lets you compile to a native binary and only includes the bits of the standard library that your program uses. But you can't use certain Java APIs, especially Reflection, and for long-running processes GraalVM is slower than the standard JVM because it doesn't have the full JIT optimization engine.
                  There really isn't GraalVM
                  Native image is experimental, it has lots of bugs on top of the inability to deal with reflection. Even it worked as advertised, Java libraries haven't been modularized and GraalVM still can't tell what to include and whatnot. You need to use PGO to overcome this. I'd like to say it's getting there, for the 3 years or so I've been eyeing it, I haven't noticed much progress.
                  But when it does work, seeing something written in Java start in under a second and not automatically grabbing 200-300MB RAM is something to behold.

                  Comment


                  • #39
                    Originally posted by bug77 View Post

                    What do you mean? How is downloading WASM IR any more dangerous than downloading JS?
                    You're assuming that people don't block Javascript. Regardless, I believe it is actually different.

                    Comment


                    • #40
                      What malicious things can WebAssembly do that Javascript can't do?
                      Sure, WebAssembly is used for cryptocurrency mining, but so is Javascript, albeit less efficiently, though that doesn't make a difference to a user, the miner is likely still using about the same percentage of cycles.
                      There is a potential Spectre/Meltdown vulnerability with WASM threads, but that isn't going to be enabled until the vulnerability has a fix.
                      Look at the instruction set (link), there's basically math, control flow, and memory.grow. Am I missing something?
                      Last edited by chinoto; 03-04-2020, 03:52 PM.

                      Comment

                      Working...
                      X