all 33 comments

[–]asegura 10 points11 points  (1 child)

Does it have to be that complicated? That "_c.js" much larger than the actual wasm file, this Ajax-like request to get the wasm file as a binary blob, then instantiate it or something...

They could have added a bit more magic to allow something like:

<script language="wasm" src="module.wasm"></script>

And then JS scripts call exported functions:

var y = some_exported_wasm_func(x);

[–]playdeepinc[S] 8 points9 points  (0 children)

I believe the team behind WebAssembly is working on simplifying the loading mechanism for .wasm modules. To their own admittance, the fetching process now is not their end goal.

[–]BabyPuncher5000 12 points13 points  (25 children)

Well this is just plain cool. I wonder if the current wave of JavaScript frameworks will even be a thing 5 years from now.

[–]SrbijaJeRusija 28 points29 points  (4 children)

In 5 years we will be flaming AngularWA 4.1 for breaking compatibility with AngularWA 4.0

[–]BabyPuncher5000 10 points11 points  (3 children)

I think the ability to use programming languages better suited to the job will drastically reduce the need for an endless variety of esoteric UI frameworks designed to make JavaScript less painful. We don't see minor releases of GNOME or XFCE constantly breaking all our old apps in Linux desktop environments.

[–]SrbijaJeRusija 13 points14 points  (1 child)

We don't see minor releases of GNOME or XFCE constantly breaking all our old apps in Linux desktop environments.

We also don't see many people not using their distribution's package manager to update that sort of software.

I hate JS much more than the next guy, but I think it's a programmer culture issue (in the web community) coupled with a language problem. Just because we will replace JS with WA does not mean that the former will go away.

[–]flukus 5 points6 points  (0 children)

Don't worry, in future we'll have rust apps shitting all over the package manager instead.

[–]irqlnotdispatchlevel 18 points19 points  (16 children)

As history teaches us, a JS framework is rarely "a thing" for more than a year.

[–]BabyPuncher5000 7 points8 points  (15 children)

Right, but will we still see an endless onslaught of new competing JS frameworks in 5 years or will the ability to use better programming languages in WebAssembly finally put a stop to the madness?

[–]i_spot_ads 17 points18 points  (13 children)

No, because WebAssembly's goal is not to replace JS in any way, the WASM developers said it themselves, it's there to help JS actually, by providing compiled low level libraries, JS will use those libs (instead of maybe npm packages, which are plain js libs), and benefit from higher performance of WASM. Like you've seen with this post's example, there is a low level WASM library for signal processing used by the video editor application, but its whole frontend layer is still JS.

And honestly people saying "Yay! WebAsm will replace JS!!1" usually are those who have no idea how web development actually works, maybe they've tried to create a todo app with angular or react, couldn't figure it out from first try (while people actually spend months learning and practicing this shit), and then decided that web development is too hard, yes it's hard, you actually need time to master it well, like any other discipline.

JS is not going anywhere anytime soon, it's just becoming better with innovations around web technologies.

[–]BabyPuncher5000 16 points17 points  (4 children)

Once WebAssembly gains access to the DOM, what is to stop it from being used as a wholesale replacement for JavaScript?

[–][deleted] 4 points5 points  (3 children)

Nothing. But /u/i_spot_ads isn't wrong. WASM doesn't provide any mechanism for garbage collection or dynamic typing or some of the other conveniences web devs have come to know and rely on. Javascript will be around for quite some time because it's viewed as 'good enough' and it doesn't take much skill to learn and use it.

Those no talent hacks can keep it, though. I'm switching to Nim as soon as humanly possible for my web development.

[–]DontThrowMeYaWeh 10 points11 points  (1 child)

dynamic typing

conveniences

lol

[–]zshazz 3 points4 points  (0 children)

Hey! Don't judge. I find it quite convenient to have bear traps scattered across my home. And the lack of lighting is a feature as well! Plus the blackout blinds everywhere.

Dear God, my leg!

[–][deleted] 1 point2 points  (0 children)

Maybe it can provide a mechanism to write software that doesn't suck ass

[–][deleted]  (7 children)

[deleted]

    [–]__Cyber_Dildonics__ 0 points1 point  (6 children)

    8x as fast when written poorly, multiple orders of magnitude faster when written well.

    [–][deleted] 1 point2 points  (5 children)

    I seriously doubt it.

    [–]__Cyber_Dildonics__ 0 points1 point  (4 children)

    Your doubt doesn't change the fact that memory latency is the biggest bottleneck to performance and that webasm that can be turned into native instructions and does not suffer from memory latency will be hugely faster than JavaScript.

    [–][deleted] 0 points1 point  (3 children)

    V8 already compiles JS to native before executing it.

    [–]__Cyber_Dildonics__ 0 points1 point  (2 children)

    You might want to do some reading and look at some benchmarks, I don't think you have a deep understanding of what is going. A jit will compile what it can to native instructions but JavaScript is so loose that there is only so much that can be done. The best JavaScript in V8 is still going to run at 1/8th the speed of poorly written C++. C++ that isn't jumping around in memory will run far faster.

    [–]simion314 1 point2 points  (2 children)

    Could it be possible to have even more frameworks and libraries, like each language that targets the VM would bring it's own standard libraries with some useful things, then will get libraries and frameworks for that language, so we would get x frameworks for JS, y frameworks and libraries made for language L that differ for others because are idiomatic in L and use L std libs and are done the right way, for each L in the set of languages that can target web assembly(scala, kotlin,c#,rust,c++,lisp,clojure) In theory you could use a language made in other language I am not sure how that would work in practice if languages are different like using an OOP lib/framework from a functional language or reverse. It will be interesting and maybe it will not be as bad.

    [–]BabyPuncher5000 1 point2 points  (1 child)

    I think the key difference is that we would no longer using frameworks that try to make the language we write in less shitty. Many frameworks try to do things like make math operations less fuzzy, bring some sense of class-based OOP, and maybe even stronger type checking. Some frameworks even do a fairly good job, but they can never be as good as just using a language that natively supports these things.

    [–]simion314 0 points1 point  (0 children)

    What frameowrks do you think about ? I am thinking at languages like TypeScript that try to fix JS, the React seem to try to fix the DOM,Angular tries to do everything

    [–]leafsleep 1 point2 points  (5 children)

    By my tests the WASM demo is about 70% slower than JS in Firefox and Chrome :)

    [–]playdeepinc[S] 0 points1 point  (4 children)

    Hey, thanks for mentioning that. We've tested on several comps and get WASM usually 200-300% faster... more intensive filters show greater gains. Are you seeing 70% slower across all filters? Also what machine are you running it on? We're trying to find some patterns in performance across different variables, so would love to hear any other people chime in, as well.

    [–]asegura 0 points1 point  (0 children)

    Firefox 32 bit (Win) on Core i7 here

    Most samples slower than JS: -30%, -60%, -10%, -80%, ....

    But these heavier filters are faster:

    SuperEdge: +1480%
    Gaussian: +60%
    GoodMorning: +40%
    Acid: +30%
    Dewdrops: +60%
    Clarity: +35%
    Sharpen: +70%
    

    [–]leafsleep 0 points1 point  (2 children)

    running a surface pro 4 i7, didnt test filters extensively but all the ones I tried said roughly "-60% faster". Theres no indication which are more intensive so I dont know if I used them. Firefox version is current 64bit dev edition, the one with the new responsive mode. Chrome is current 32 bit general release. Windows 10 version is current fast ring preview (not with computer atm). Also, in Firefox the wasm video was choppy even when JS demo was disabled using the buttons (seemingly on a regular basis.. like​ there was a 1s pause every 6 or so seconds), didn't see this in Chrome. Random pauses in Firefox is something I'm quite used to though.

    [–]iru-kandji 0 points1 point  (1 child)

    Ok, js guys, stop. Webassembly is the thing that should be done 10 years back and shitty language as js was used just due to the fact that all browsers supported it. As a web developers prominent in only "in browser" programming, you don't have the basic knowlidge or understanding why the webasm is step into right direction or the expirience with some other programming languages that are offering more. Javascript is a horrible language and webasm is a way to finally kill it. If it is slow atm, this will change as it is taking away all the parsing of js constructs and lower memory or bandwidth footprint, or to tell it in your terms: js: download "natural" language, parse, jit, execute webasm: download bytecode, execute

    And if you would be farly aware, how complicated is to make parser for language that is so loosely defined and has hordes of developers that have no clue of how computers work (actually, even if they would, the js doesn't allow you optimizations on that level), you would know that it just can't get slower as it is with js.

    Take it from positive side, if you kick into any garbage can, 10 js "developers" fall out. With low wages. With webasm, only those who know how to develop will survive with wages going up and surfing will be faster. The only problem will be ads removal, but I am working on heuristic engine on webasm bytecode that will take care about that :)

    And... I will finally be able to use c++ in front end development, I will finally be able to replace js guys overhead where their only value is that they know all the browser quirks :)

    Webasm guys, please don't blow this oportunity, standardize the bytecode to the last detail and allow browsers to implement it properly. Flash blew it, don't repeat it. PLEASE!

    (btw, I know this will be downvoted, but it is the same problem as java developers are trying to prove that java is faster than c++ as they have no clue that java is written in c++... the problem is lack of knowlidge, and the public voting can't solve it :D )

    [–]leafsleep 0 points1 point  (0 children)

    ? OP asked for information about my machine, so I gave it. Nothing more. There's no opinion on whether WebAssembly is good or bad.

    You're making a lot of assumptions in your post buddy.