Introduction to Web Assembly

Slides:



Advertisements
Similar presentations
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, September 19, 2013 Session 3: JavaScript.
Advertisements

Instruction Set Design
Java Script Session1 INTRODUCTION.
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS 9.1 Introduction Application programs are typically developed, compiled, and run on host system Embedded programs.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Software Development and Software Loading in Embedded Systems.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Niklas Smedberg Senior Engine Programmer, Epic Games
Introduction to .Net Framework
CS 355 – Programming Languages
Topics Introduction Hardware and Software How Computers Store Data
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
Msdevcon.ru#msdevcon. ИЗ ПЕРВЫХ РУК: ДИАГНОСТИКА ПРИЛОЖЕНИЙ С ПОМОЩЮ ИНСТРУМЕНТОВ VISUAL STUDIO 2012 MAXIM GOLDIN Senior Developer, Microsoft.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
A computer contains two major sets of tools, software and hardware. Software is generally divided into Systems software and Applications software. Systems.
Connect with life Cheryl Johnson VSTS Solution Expert | Canarys Automations Pvt Ltd Performance Testing.
1 WebAssembly: WASM means more powerful web apps. 류철 한국전자통신연구원 모바일서비스플랫폼연구팀.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Compiling examples in MIPS
10/18/2017 3:02 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Computer Basics.
Applications Active Web Documents Active Web Documents.
DHTML.
Introduction to Operating Systems
Muen Policy & Toolchain
Chapter 2.1 CPU.
“Under the hood”: Angry Birds Maze
Part of the Assembler Language Programmers Toolbox
Learning to Program D is for Digital.
A Closer Look at Instruction Set Architectures
Application with Cross-Platform GUI
A Closer Look at Instruction Set Architectures
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
Computer Science 210 Computer Organization
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
A lot of Software Development is about learning
Myth Busting: Hosted Web Apps
Power Apps & Flow for Microsoft Dynamics SL
Parallel Programming in Contemporary Programming Languages (Part 2)
DotnetConf 11/14/2018 3:27 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE.
Microsoft Ignite /14/ :21 AM BRK2101
Introduction to Operating Systems
Myth Busting: Top 5 Web App Myths
Chapter 10 Programming Fundamentals with JavaScript
Computer Science 210 Computer Organization
Tooling and Diagnostics
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Introduction to .NET By : Mr. V. D. Panchal Content :
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS
Topics Introduction Hardware and Software How Computers Store Data
Web Development in Visual Studio 2017
Microsoft Dynamics.
ASP.NET 4.0 State Management Improvements – Deep Dive
CMP 131 Introduction to Computer Programming
The Assembly Language Level
Embedded System Development Lecture 13 4/11/2007
Office 365 Development.
Creating Computer Programs
JavaScript CS 4640 Programming Languages for Web Applications
5/8/2019 3:20 AM bQuery-Tool 3.0 A new and elegant way to create queries and ad-hoc reports on your Baan/Infor ERP LN data. This Baan session is a query.
Creating Computer Programs
Running C# in the browser
Blazor A new framework for browser-based .NET apps Ryan Nowak
WebAssembly: The Browser is your OS
JavaScript CS 4640 Programming Languages for Web Applications
What if I told you….
Just In Time Compilation
Presentation transcript:

Introduction to Web Assembly Microsoft Connect 2016 5/20/2018 6:09 AM Introduction to Web Assembly Kishorekumar © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Evolution of Web Assembly Web Assembly Structure What it is for Microsoft Connect 2016 5/20/2018 6:09 AM Agenda What is Web Assembly Evolution of Web Assembly Web Assembly Structure What it is for Roadmap © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What is Web Assembly Web Assembly is a new type of code that can be run in modern web browsers it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as C/C++ with a compilation target so that they can run on the web It is also designed to run alongside JavaScript, allowing both to work together New Standard developed by Mozilla, Microsoft, Google and Apple Fast to load, runs safely Works on any device

History Key person: Brendan Eich 1995 – Created JavaScript 1995 - Leading SpiderMonkey 1998 – Started Mozilla 2009 – asm.js Mozilla experiment 2013 – asm.js Published 2013 – Spread asm.js idea to Microsoft 2014-15 – Make other browser vendors to join WebAssembly W3C Group

How JavaScript works in Browser In programming, there are generally two ways of translating to machine language. You can use an interpreter or a compiler. With an interpreter, the translation happens pretty much line-by-line, on the fly A compiler on the other hand doesn’t translate on the fly. It works ahead of time to create that translation and write it down. Interpreters are quick to get up and running. You don’t have to go through that whole compilation step before you can start running your code. You just start translating that first line and running it function arraySum(arr) { var sum = 0; for (var i = 0; i < arr.length; i++) { sum += arr[i]; }

How JavaScript works in Browser In a loop, Interpreter have to do the same translation over and over and over again Compiler takes a little bit more time to start up because it has to go through that compilation step at the beginning. But then code in loops runs faster, because it doesn’t need to repeat the translation for each pass through that loop Just-in-time compilers: the best of both worlds-As a way of getting rid of the interpreter’s inefficiency—where the interpreter has to keep retranslating the code every time they go through the loop—browsers started mixing compilers in At first, the JIT-Compiler just runs everything through the interpreter If the same lines of code are run a few times, that segment of code is called warm. If it’s run a lot, then it’s called hot Each line of the function is compiled to a “stub”. The stubs are indexed by line number and variable type When a part of the code is very hot, the monitor will send it off to the optimizing compiler. This will create another, even faster, version of the function that will also be stored

How JavaScript works in Browser An example optimization: Type specialization monomorphic - always called with the same types polymorphic -called with different types from one pass through the code to another Even with these improvements, though, the performance of JavaScript can be unpredictable. And to make things faster, the JIT has added some overhead during runtime, including: optimization and deoptimization memory used for the monitor’s bookkeeping and recovery information for when bailouts happen memory used to store baseline and optimized versions of a function

Web Assembly Structure

Sections of Web Assembly Required: Type. Contains the function signatures for functions defined in this module and any imported functions. Function. Gives an index to each function defined in this module. Code. The actual function bodies for each function in this module. Optional: Export. Makes functions, memories, tables, and globals available to other WebAssembly modules and JavaScript. This allows separately-compiled modules to be dynamically linked together. This is WebAssembly’s version of a .dll. Import. Specifies functions, memories, tables, and globals to import from other WebAssembly modules or JavaScript. Start. A function that will automatically run when the WebAssembly module is loaded (basically like a main function). Global. Declares global variables for the module. Memory. Defines the memory this module will use.

Sections of Web Assembly Table. Makes it possible to map to values outside of the WebAssembly module, such as JavaScript objects. This is especially useful for allowing indirect function calls. Data. Initializes imported or local memory. Element. Initializes an imported or local table.

DEMO https://wasdk.github.io/WasmFiddle/?xk3e1 Microsoft Connect 2016 5/20/2018 6:09 AM DEMO https://wasdk.github.io/WasmFiddle/?xk3e1 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What it is for Fill gaps in JavaScript Develop using language you like Heavy calculation Examples: P2P applications Image / Video / Music editing Live video augmentation Platform simulation CAD application

Web Assembly is faster than JS WebAssembly is faster than JavaScript in many cases because: fetching WebAssembly takes less time because it is more compact than JavaScript, even when compressed. decoding WebAssembly takes less time than parsing JavaScript. compiling and optimizing takes less time because WebAssembly is closer to machine code than JavaScript and already has gone through optimization on the server side. reoptimizing doesn’t need to happen because WebAssembly has types and other information built in, so the JS engine doesn’t need to speculate when it optimizes the way it does with JavaScript. executing often takes less time because there are fewer compiler tricks and gotchas that the developer needs to know to write consistently performant code, plus WebAssembly’s set of instructions are more ideal for machines. garbage collection is not required since the memory is managed manually.

RoadMap Full threading support SIMD types and intrinsics Zero-cost exceptions (stack inspection and unwinding) Coroutines Dynamic linking DOM integration Integrated garbage collection Tail-call optimization Multi-process support