An introduction to WebAssembly

Поделиться
HTML-код
  • Опубликовано: 7 фев 2021
  • Want to write a web application? Better get familiar with JavaScript. JavaScript has long been the king of front-end. While there have been various attempts to dethrone it, they have typically involved treating JavaScript as an assembly-language analog that you transpile your code to. This has led to complex build pipelines that produce JavaScript which the browser has to parse and you still have to debug. But what if there were an actual byte-code language you could compile your non-JavaScript code to instead? That is what WebAssembly is.
    In this session we will explain how WebAssembly works and how to use it. We'll cover what it is, how it fits into your application, and how to build and use your own WebAssembly modules. And, we'll demo how to build and use those modules with both Rust and the WebAssembly Text Format. That's right, we'll be live coding in an assembly language. We'll also go over some online resources for other languages and tools that make use of WebAssembly.
    When we're done, you'll have the footing you need to start building applications featuring WebAssembly. So grab a non-JavaScript language, a modern browser, and let's get started!
    PUBLICATION PERMISSIONS:
    Original video was published with the Creative Commons Attribution license (reuse allowed). Link: • An introduction to Web...
  • НаукаНаука

Комментарии • 244

  • @a.h.s.3006
    @a.h.s.3006 3 года назад +94

    8:20
    "So here we got, uh, it's no longer C code, it's Java code, and you can tell it's Java code because it's identical. "
    Exactly how I felt when learning Java

  • @aliftirasvasilis7159
    @aliftirasvasilis7159 2 года назад +15

    Good lord, this guy has the most luxuriant wizard beard I've ever seen in my life. And he teaches web assembly, he's the closest thing to a fantasy wizard that real life has produced. My good sir, I love your beard!

  • @jesusgeek
    @jesusgeek 3 года назад +317

    2:30 "The nice thing about JS: If you don't like it, you can pick a different language, ... as long as its JS".
    So on point ^^

    • @sob3ygrime
      @sob3ygrime 3 года назад +3

      hahah I didn't even realize he said it that way. That's funny.

    • @blackcitadel37
      @blackcitadel37 2 года назад +14

      JS is not a language, it's a curse.

    • @sinmidani9322
      @sinmidani9322 2 года назад +8

      There's typescript and... Yeah, there's typescript

    • @ofskittlez
      @ofskittlez Год назад +2

      I actually do like JavaScript. Quirks and all.

    • @ganeshacharya234
      @ganeshacharya234 Год назад

      Made my day :)

  • @trevorrogers9276
    @trevorrogers9276 3 года назад +11

    This mans purity of soul is beaming.

  • @jaschardomann5407
    @jaschardomann5407 3 года назад +85

    At last, JavaScript's problems are being honestly addressed. That's a good thing. Acceptance is the first path to improvement. I hope WASM solves the problems adequately. Very honest and great talk.

  • @Schweppese
    @Schweppese 3 года назад +596

    The moment someone refers to Rust and C as a higher level language, you know you're talking with an OG...

    • @xCwieCHRISx
      @xCwieCHRISx 3 года назад +86

      @FichDich InDemArsch real ogs program by connecting transistors

    • @xrafter
      @xrafter 3 года назад +48

      Rust is a High level language.
      C is still higher than assembly .

    • @morpheus7422
      @morpheus7422 2 года назад +21

      C is a high level language or should we say the mother of all high level languages.

    • @cryp0g00n4
      @cryp0g00n4 2 года назад +1

      The slide showed C++

    • @cerealgrapist7386
      @cerealgrapist7386 2 года назад

      I mean they really are high level languages lol

  • @TheRealAfroRick
    @TheRealAfroRick 2 года назад +2

    You're the type of dude that I would enjoy sitting down, having lunch with, and just talking about the "possibilities".

  • @jackspdr
    @jackspdr 3 года назад +162

    Gandalf's final embodiment, Gandalf the Web

  • @RodLaycock
    @RodLaycock 10 дней назад

    I have been looking for something like this to explain WebAssembly to my team. Seriously this is just so easy to understand and the beard is heroic.
    Keep up the good work.
    thanks

  • @matking2800
    @matking2800 3 года назад +16

    Incredible talk! I appreciate how you showed the entire development cycle, including what language to use, how to compile to WASM and how to then call that WASM code. Also, the explanation about the "firetruck" string was gold!

  • @dkennell998
    @dkennell998 3 года назад +11

    Thanks for going into the details of how a stack based language works, I didn't know any of that, and you explained/showed the concept so elegantly. I really appreciate you doing that instead of breezing through it.

  • @brandonsnider5871
    @brandonsnider5871 Месяц назад

    Amazingly thorough video. I wish others were this accessible, while still clearly outlining the concept.

  • @IBITZEE
    @IBITZEE 3 года назад +7

    Dude,,,, such good info...
    You are now 'nominated' my #1 source for WASM things...

  • @mukulr5171
    @mukulr5171 3 года назад +6

    This is the best video on web assembly I have seen on web till date.
    Thanks 👍

  • @benjaminsternlieb2182
    @benjaminsternlieb2182 2 года назад +1

    This is a very nice - a presentation for folks in the field. No excess baggage or buzz terms. Just what it is. Finally, this is the nicest unix beard I've seen in a while!

  • @codeconcept
    @codeconcept 2 года назад +1

    Crystal clear intro to WebAssembly: thanks a lot Guy!

  • @gabieh4979
    @gabieh4979 2 года назад

    Halfway into the vid and I love the way he delivers this.

  • @sob3ygrime
    @sob3ygrime 3 года назад +2

    This is super cool, and thanks for the demo. I can't wait to start dabbling around WA ! :)

  • @quocnho
    @quocnho 2 года назад +2

    Thanks for your sharing!
    Easy to understand and useful in developing other languages.

  • @ariyoujahan9662
    @ariyoujahan9662 2 месяца назад

    I'm not the kind that usually comments on videos, bit it was so good that i couldn't help myself.

  • @SteveHazel
    @SteveHazel 3 года назад +36

    this guy should be the host for this whole youtube channel...

  • @nickschmitt8594
    @nickschmitt8594 3 года назад +85

    I would follow this guy into the very fires of mordor

    • @nickschmitt8594
      @nickschmitt8594 3 года назад +9

      @FichDich InDemArsch Lighten up edgelord

    • @kyouhyung
      @kyouhyung 3 года назад +4

      With a firetruck (that is not a number)

    • @bp56789
      @bp56789 3 года назад +2

      One beard to rule them all.

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein 3 года назад +4

      @FichDich InDemArsch people that are afraid of being cringy often aren't very skilled themselves. They tend to be afraid of people finding out how incompetent they are. That's why they often talk down on other people as well.

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein 2 года назад +1

      @@royhammel5205 Just that you can be respected for your skills even if you act in a silly way.

  • @emjizone
    @emjizone 2 года назад

    Thanks ! You bring my will to code back with this.

  • @nessitro
    @nessitro 3 года назад +1

    Finally found the wizard who's installing our softwares :D
    Great Talk

  • @misterlich2826
    @misterlich2826 3 года назад +20

    Good stuff - I've been using Blazor (basically C# to WASM) since January to write a product and it's been pretty great, minor hiccups with JS interactions but that's probably the fault of the way Blazor is designed, not WASM's fault. WebAssembly definitely is a game changer for modern application development, hope there's a big shift towards it.

    • @Rana-yk6xn
      @Rana-yk6xn Год назад

      Two years later, what do you think? Things have changed quite a bit!
      WA is an interesting offer that has not yet seen massive addoption but to someone who knows Rust... this is a game changer. How did I not know about this before?

  • @sajithnandasena
    @sajithnandasena 3 года назад +1

    This video is the best explanation for WA.

  • @micromoon4592
    @micromoon4592 2 года назад

    Really great introduction to webassembly!

  • @sagnikbhattacharya1202
    @sagnikbhattacharya1202 3 года назад +8

    This is the WebAssembly talk I had always wanted

  • @zeroshadow96
    @zeroshadow96 3 года назад +1

    I came for WebAssembly but I gotta admit the Spongebob joke at the beginning is what sold me.

  • @o0GzxS41BIbyux3vEoNehl5FH
    @o0GzxS41BIbyux3vEoNehl5FH 3 года назад +3

    Really great video. It explains me a lot.
    But about weirdness of the stack. It is like a stack works.
    When you try to invoke an assembler operation/instruction it takes a values/arguments from a top of the stack.
    After you invoke i32.add instruction (which is two argument instruction), two values from stack are taken, sum up, and the result is pushed on top of the stack.
    In real assembler x86 to add two numbers, first you need to move the values from stack into CPU registers eg. AX i BX. There they are sum up and the result is stored into register AX. Then you need to move the result from AX back to stack if some other function need this as argument.
    Functions exchange arguments and results using a stack.
    That is why when you invoke a function Foo(int a) what calls itself, you eventually get a Stack Overflow Exception.
    So, when you initialize variable $sum, value is taken from the stack to memory. Then you invoke a call instruction that runs $callback function. But the $callback function expects one argument to be on the top of the stack. So before you invoke a call instruction you need to put again the value to the stack - but this time from a memory, from a variable $sum. Then you call a $callback function, and again the value is taken from a stack. And finally, to return from $add function, you need again put a return value to the top of the stack - again from a variable $sum. Because some other function that called this $add function, expects a result on stack.

  • @dannielrolfe8079
    @dannielrolfe8079 Год назад

    Fantastic tutorial. Thank you.

  • @kuntaldas2843
    @kuntaldas2843 3 года назад +5

    you people please give the original video some love 🙏🏻

  • @1mikegrn
    @1mikegrn 3 года назад +20

    All I wanted for Christmas was to learn Web Assembly, and Santa did not disappoint :D

  • @ulfcarlstrom6684
    @ulfcarlstrom6684 2 года назад +1

    Way back we used to have byte code virtual machines in the browser in the form of Java Applets. Remember the and tags. Any language you could compile to java byte code could be loaded and as an applet. But eventually it died. As far as i remember the interface for interacting with the browser from the applet was a bit limited.

  • @ASeventhSign
    @ASeventhSign 3 года назад +3

    Oh good gawd this was awesome!

  • @DavidAlsh
    @DavidAlsh 3 года назад +2

    Thanks for sharing, great presentation! Which proposal is the one to watch for DOM access from within wasm modules?

  • @mattiafrega6135
    @mattiafrega6135 Год назад

    great, interesting and fun talk!

  • @AndrewRobinson-ee7um
    @AndrewRobinson-ee7um Год назад

    Ver interesting. Thanks. I really wanted you to say “That’s all folks” at the end.

  • @lesfreresdelaquote1176
    @lesfreresdelaquote1176 3 года назад +11

    It is eerily reminiscent of Lisp as for the syntax...

  • @hobbyturystaSEO
    @hobbyturystaSEO 3 года назад +8

    I would like to drink a beer with the author of this Coding Tech video web worker :P

  • @Micahtmusic
    @Micahtmusic 2 года назад

    it’s the year of our lord 2022 and we’re talking about new stuff with… VMs. what a time to be alive

  • @moofymoo
    @moofymoo 3 года назад +5

    and on 9th day God taught man WebAssembly and it was good.

  • @OroborOSX11
    @OroborOSX11 Год назад +4

    Interesting talk. The web desperately needs something that can crank out heavy metal performance like only native app experiences can at the moment. Figma is a great example of WebASM+WebGL being put to good use

  • @mehradsadeghi
    @mehradsadeghi 6 месяцев назад

    Nice introduction 👍🏻

  • @AnyFactor
    @AnyFactor 3 года назад +121

    His beard makes him look credible. Even though he looks like 100 years old a quick google search revealed he is in his mid-40s.

    • @xfire3778
      @xfire3778 3 года назад +3

      He said he used to write code in the 80s, so I highly doubt that

    • @wstein389
      @wstein389 3 года назад +7

      @@xfire3778 I'm in my mid-40s and used to write code in the 80s. I just had to talk my parents/grandparents into getting me a computer, and it's off to the races! There were many PC's in the mid-80s that a kid could get (e.g., Atari, TI 99 4A, C-64, etc.) and they were all very programming centric.

    • @tomahawk5357
      @tomahawk5357 2 года назад +2

      @@wstein389 Amstrad CPC 464 for me. Was used mainly in games (Renegad, Bomb Jack etc...). Only program I wrote in VB I think is positioning 2 points and drawing a line.

  • @aloky247
    @aloky247 2 года назад +1

    Yeah! Unix beard is back!!

  • @AKA96369
    @AKA96369 Год назад

    Amazing!! thank you!!

  • @0x400Bogdan
    @0x400Bogdan 3 года назад +1

    instant like just for the look of this guy

  • @spencergresoro
    @spencergresoro 3 года назад

    Great video

  • @tervancovan
    @tervancovan Год назад +1

    wooooow awesome

  • @chewbaccarampage
    @chewbaccarampage 3 года назад +23

    Holy crap! COBOL to web assembly is a big deal! There's so much legacy banking software. This could be a way to migrate.

    • @xtrailz
      @xtrailz 3 года назад +10

      Yeah, coz banks are gonna run their mission-critical software in a browser ... NOT!

    • @chewbaccarampage
      @chewbaccarampage 3 года назад

      @@xtrailz but they are running node.js.

    • @chewbaccarampage
      @chewbaccarampage 3 года назад +11

      @@xtrailz just for context, the COBOL to WASM compiler was written by CloudFlare for the purpose of running New Jersey's Employment Insurance system on Node.js. It's just really hard to find young COBOL developers these days, so there's a need to move these systems. I worked at a consulting firm porting COBOL to Java and it's hard when all the original developers are retired or dead. So something that lets you run the original code in a modern system is huge. It let's you easily write automated tests to do an apples to apples comparison during a port.

    • @xtrailz
      @xtrailz 3 года назад +1

      @@chewbaccarampage It's useless, and let me tell you why.
      The examples on the Cloudflare website produce HTTP network responses. 99.99% of Cobol is not server code; it is interactive terminal-based applications and batch programs. The batch stuff might convert but the terminal stuff won't.
      Also, what happens when somebody wants to change the code? You need to go back and change the original Cobol code, not WASM. That would be crazy. You still need Cobol developers unless you plan to never modify the code once it has been transpiled.

    • @chewbaccarampage
      @chewbaccarampage 3 года назад +5

      @@xtrailz I guess I was thinking more about the use case of running the wasm with fast-check against a ported implementation to do model testing between the two implementations. When we did the port, we basically had a business user run trades through the system manually and compare it with the Java implementation. It took 1 year to port 90% of the code and 4 more years to find the edge cases. Even at the end, we weren't entirely confident we found all the edge cases. The business user would forget about edge cases all the time.
      I don't think we'd ever run the Cobol code as a wasm in prod, but as a migration tool, there's definitively a ton of value.

  • @asmitkumar9068
    @asmitkumar9068 3 года назад

    Great😊😊

  • @tengstrand
    @tengstrand 3 года назад +6

    Great presentation! WebAssembly is cool but I would love to have support for double buffered graphics directly in the web browser. By the way, I also started with 6502 (Vic-20)!

  • @mineeduka4488
    @mineeduka4488 3 года назад

    thanks so much for this

  • @bberakable
    @bberakable Год назад +1

    Such a great talk that distills WebAssembly down to its fundamentals. Thanks for sharing!

  • @sakuranooka
    @sakuranooka Год назад +2

    When I was learning Java in the 90ies, I used to program Java applets, which were Java programs that compiled into Java bytecode that in turn ran in the JVM embedded in the browser. Now this webassembly thing looks like the wheel has partially been reinvented as one could simply have reused the Java bytecode and written compilers that compile any language into this bytecode, right?

  • @levyroth
    @levyroth 2 года назад

    You are a wizard.

  • @df6148
    @df6148 Год назад

    Behind the beard and the grey hair is a big kid at heart that still loves to program.
    As for me I think I’ll always be a Pokémon player at heart.

  • @kualta
    @kualta Год назад

    great talk

  • @cariodesigns
    @cariodesigns Год назад

    The OG SMOSH joke... Your son is CULTURED!

  • @quintencabo
    @quintencabo Год назад

    I love how it's like lisp I didn't expect that at all

  • @pau1976
    @pau1976 3 года назад +1

    Very good talk, it "starts" at minute 8.

  • @marh122
    @marh122 Год назад

    thank you gandalf

  • @pradeepn7
    @pradeepn7 3 года назад +1

    Thanks, You explained it well.

  • @syedhamza6779
    @syedhamza6779 Месяц назад

    Final level coding boss

  • @emiliahane
    @emiliahane 2 года назад +1

    Great attitude in the video that makes learning fun, thank you. However I must sadly tell you that the code examples are wrong. At 13:00 the parameter is missing for the callback, so the code line should be (import "math" "callback" (func $callback (param i32))). Although less grave, but also an error, a closing bracket is missing at 15:35 at line 12, it should be (call $callback (local.get $sum)).

  • @SeanMacdonald_CodeMonk
    @SeanMacdonald_CodeMonk 2 года назад

    how do you make helper functions (like loadWasm) available to you in the console. Where did you define it?

  • @exchange4918
    @exchange4918 2 года назад

    I like this guy

  • @xxaqploboxx
    @xxaqploboxx Год назад

    thank u gandalf

  • @TheRealKitWalker
    @TheRealKitWalker Год назад +1

    0:12 and 2:01🤭🤭😂😂😂 you really had me in splits

  • @als5321
    @als5321 3 года назад +4

    Thank you for proving it was not vaporware, cus its exactly what I was thinking it was...whew.

  • @FuyangLiu
    @FuyangLiu 3 года назад +1

    I've got a question: why didn't we just put JVM into the browser and other languages can just compile to Java byte code so it can run in the browser?
    What's the benefits to invent again this webassembly? 🤔

  • @AviralBajpai
    @AviralBajpai 2 года назад

    Dumbledore teaching web development?!? Nice!

  • @sakuranooka
    @sakuranooka Год назад +1

    I'm not a Java programmer let alone a Java expert, but Number.MIN_VALUE>0 looks similar to the mathematical convention that the minimum of the empty set is PLUS infinity. The reason for this convention is to make sure that the recurrence relation min(A u {x}) = min(min(A), x) holds, where A is a set of numbers and x is a number. By setting A equal to the empty set you can easily convince yourself of the meaningfulness of the convention.

  • @eleonoramendy
    @eleonoramendy 2 года назад

    I am also a fan of Javascript. It does not mean I am ever going to use it. I am well aware we sort of have to, and so long it is not Javascript I am okay with that.
    Edit: Lovely video by the way. Felt like a fresh cup of coffee in the morning. Kind of weird this passed me by before; so I learned something new - fresh out of the nerdy depths like a steaming cup of java. --END OF SCRIPT--

  • @EricMuranoAU
    @EricMuranoAU 3 года назад

    Transpiling - just another word for compiling :D

  • @johnkost2514
    @johnkost2514 Год назад

    This reminds me of Java and Flash (AS2/AS3) back in the olde days..
    Oh ya, Silverlight too!

  • @sarovilhelmyekanian5735
    @sarovilhelmyekanian5735 3 года назад +8

    Just curious, does anyone have link to the "previous talk", where they talked about parsing and excecuting Javascript?
    (In 2:56)

  • @MayconRodrigues1
    @MayconRodrigues1 Год назад

    In addition Golang also compiles in Wasm.

  • @keshavbiswa
    @keshavbiswa 3 года назад

    Holy Shit. Never expected Odin would be a fan of WebAssembly. Just Kidding

  • @danielleblanc5923
    @danielleblanc5923 9 месяцев назад

    Nice presentation.
    Web Assembly is the W3C's take on what Java did quite some time ago.
    Microsoft didn't want it because it was not their stuff, so they decided to implement it their own way, which went against the licence. Then they decided that if they were not going to have it their own way they were not going to use it so they decided to kill it.
    At the time, IE's JavaScript engine was somehow tied to Microsoft's JVM.
    Either you used the standard JVM and JavaScript worked but the applets did not (only support for Java 1.1 ?) or you could set things up so the browser used Sun's JVM in which case the servlets worked fine but the JavaScript engine has all sorts of funny bugs.
    Finally, Sun was bought by Oracle so Java became the property of a for profit company so nobody wanted to use it on the client side. This set the last nail in the coffin for client side Java on the Web.
    Now; Web assembly is the same concept except from the W3C, so it is never going to be closed source.

  • @salehgeberty
    @salehgeberty Год назад

    Greate But What About UI-UX, Java, C, C#, C++ .. etc all are made for heir own UI, let say for example a photo editing app, how it will be Rendered in the browser?

  • @BusinessWolf1
    @BusinessWolf1 2 месяца назад

    I look forward to making infinite useEffect loops in React in WASM in Rust.

  • @anouarbagent2511
    @anouarbagent2511 2 года назад

    thanks to you I know now about Magnum that means an automatic subscribe and Like, thanks.

  • @TheFhdude
    @TheFhdude 3 года назад

    So what is the difference with Java Applets or Flash?

  • @HK-sw3vi
    @HK-sw3vi 3 года назад +2

    he's every developer's Santa

  • @feihcsim7045
    @feihcsim7045 3 года назад +1

    santa is actually a great presenter

  • @jihadjoe4900
    @jihadjoe4900 9 месяцев назад

    Bro is a wizard

  • @edwardmacnab354
    @edwardmacnab354 2 года назад

    for those initial examples , i.e. firetruck ,why has no one created an analyzer that gives an in depth breakdown of what your code is doing , say at the line level etc. etc. The error message route that has been chosen is obviously never coming out of Beta right ? Instead people have chosen to skirt the issue and create a multiverse of Alternate realities. Now that everyone has shown how smart they are ?

  • @DampeS8N
    @DampeS8N 3 года назад +5

    Does anyone have anything useful in a production setting (including internally) that they have used WebAssembly for?

    • @nodidog
      @nodidog 3 года назад +6

      Pretty sure Figma is built with web assembly

    • @DampeS8N
      @DampeS8N 3 года назад

      @@nodidog So it is, ty.

    • @chewbaccarampage
      @chewbaccarampage 3 года назад +4

      The .NET runtime was ported to web assembly. You can import .NET DLLs to you web app.

    • @chewbaccarampage
      @chewbaccarampage 3 года назад +6

      Forgot, Unity was also ported to web assembly, so you can write games in Unity, but run them on the web.

    • @nickschmitt8594
      @nickschmitt8594 3 года назад +2

      The popular chess website Lichess uses the WASM port of the chess engine Stockfish

  • @meepk633
    @meepk633 2 года назад

    I guess I don't understand the practicality of Webassembly if you still have to use JS for rendering. I understand that some serverless apps would need that performance edge. But for the vast majority of sites, is adding Webassembly to the stack even remotely justified? Is it a certainty that Webassembly will be able to directly manipulate the DOM in the future?

  • @ShaunPatterson
    @ShaunPatterson 3 года назад +1

    "transpiling ES6 to something that will run on Internet Explorer" Sick burn

  • @arturampilogov9801
    @arturampilogov9801 5 месяцев назад

    Number.MIN_VALUE in JavaScript has the misleading name. The specification says: "must be the smallest non-zero positive value that can actually be represented by the implementation".
    If we think of it as "PositiveNumber.MIN_VALUE", than it makes sense that it should be `> 0` and very close to 0.

  • @dickheadrecs
    @dickheadrecs Год назад

    back in the day they didn’t let you do computer science without a beard like this dude

  • @software_designer
    @software_designer Год назад +1

    Cool

  • @JustThink2000
    @JustThink2000 7 месяцев назад

    Dude, your beard is wicked!

  • @marusdod3685
    @marusdod3685 3 года назад +2

    so I can just program in my favourite language and compile it to wasm, no need to shit up my codebase with javascript?

  • @AjayKumar-fd9mv
    @AjayKumar-fd9mv 3 года назад

    👍

  • @azatecas
    @azatecas 2 года назад

    my dude, why didnt i find your channel earlierr

  • @lagadeno965
    @lagadeno965 3 года назад

    Thanks front end hagrid