Benchmarking Assemblyscript for Faster Web Applications

Total Page:16

File Type:pdf, Size:1020Kb

Benchmarking Assemblyscript for Faster Web Applications Iowa State University Capstones, Theses and Creative Components Dissertations Spring 2020 Benchmarking AssemblyScript for Faster Web Applications Nischay Venkatram Follow this and additional works at: https://lib.dr.iastate.edu/creativecomponents Part of the Numerical Analysis and Scientific Computing Commons, Programming Languages and Compilers Commons, and the Software Engineering Commons Recommended Citation Venkatram, Nischay, "Benchmarking AssemblyScript for Faster Web Applications" (2020). Creative Components. 558. https://lib.dr.iastate.edu/creativecomponents/558 This Creative Component is brought to you for free and open access by the Iowa State University Capstones, Theses and Dissertations at Iowa State University Digital Repository. It has been accepted for inclusion in Creative Components by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. Benchmarking AssemblyScript for Faster Web Applications by Nischay Venkatram A report submitted to the graduate faculty in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE Major: Computer Engineering Program of Study Committee: Joseph Zambreno, Major Professor The student author, whose presentation of the scholarship herein was approved by the program of study committee, is solely responsible for the content of this dissertation/thesis. The Graduate College will ensure this dissertation/thesis is globally accessible and will not permit alterations after a degree is conferred. Iowa State University Ames, Iowa 2020 Copyright c Nischay Venkatram, 2020. All rights reserved. ii TABLE OF CONTENTS Page LIST OF FIGURES . iii ACKNOWLEDGMENTS . iv ABSTRACT . .v CHAPTER 1. Introduction . .1 CHAPTER 2. Related Work . .2 2.1 Javascript Performance . .2 2.2 Webassembly . .3 2.3 Benchmarks . .3 CHAPTER 3. Methodology . .5 3.1 Research Questions . .5 3.2 Benchmark Selection . .5 3.2.1 Breadth First Search . .6 3.2.2 Fast Fourier Transform . .6 3.2.3 Lower Upper Decomposition . .7 3.2.4 Sparse Matrix Vector Multiplication . .7 3.2.5 Page Rank . .7 3.3 Experimental Platform . .7 3.3.1 Setup . .7 3.3.2 Implementation . .7 3.3.3 Execution . .9 CHAPTER 4. Results . 10 4.1 Javascript vs Assemblyscript . 10 4.2 Key Insights . 12 CHAPTER 5. Conclusion and Future Work . 16 BIBLIOGRAPHY . 17 iii LIST OF FIGURES Page 4.1 Average Runtime . 11 4.2 Breadth First Search . 11 4.3 Fast Fourier Transform . 12 4.4 Lower Upper Decomposition . 13 4.5 Page Rank . 14 4.6 Sparse Matrix Vector Multiplication . 14 iv ACKNOWLEDGMENTS Firstly, I would like to thank my parents and family for believing in me and being a constant source of motivation throughout my academic and personal endeavors. I would also like to thank Dr. Zambreno for his guidance and support throughout the research and writing of this paper. I am genuinely grateful to everyone who has helped and inspired me in any way throughout my career as a student and a software engineer. v ABSTRACT As web applications are becoming increasingly complex, it is crucial now more than ever to be able to develop web apps with an emphasis on performance to ensure a responsive and smooth user experience. Since the introduction of Webassembly as a compilation target for the web, the promise of writing programs that can run at native speed seemed revolutionary in theory. But the real world performance benefits of Webassembly in comparison to Javascript is not clearly understood. This paper evaluates the current performance of Assemblyscript - a strict subset of TypeScript that compiles to Webassembly, and Javascript in the areas of numerical computing across multiple browsers. A set of benchmarks were developed in Assemblyscript that includes numerical computing problems from the Ostrich Benchmark suite. The tests were executed across Chrome and Firefox. After studying the results from the benchmarks that were created, we find that Assemblyscript demonstrates speedups that range between 1.1-7.2x. It is also noticed that writing idiomatic Typescript can slow down Assemblyscript in certain scenarios. In conclusion, this study suggests that Assemblyscript (and Webassembly) provides far more consistent and predictable performance in comparison to Javascript. 1 CHAPTER 1. Introduction In the early 90's, web pages were static and did not support any dynamic behavior after a page was loaded in the browser. To enable scripting on the web, Brendan Eich and the Netscape team developed Javascript in 1995 [1]. This allowed developers to make web pages dynamic and perform simple tasks like form validation or HTML manipulation in the browser, without requiring any interaction with the server. Since then, Javascript has become one of the most prominent languages in the software engineering world. It is used across multiple different platforms and devices, and for a plethora of different applications. Over the past two decades, these applications have become incredibly complex and to ensure that users have a good experience, performance has become a key factor. Continuous performance improvements to browser engines and compilers eventually led to the creation of Webassembly - a new binary format that is secure, portable, and serves as a compilation target for typed languages like C/C++ and Rust, allowing faster computation times than Javascript [2]. This would allow developers to write the computationally intensive parts of an application in languages like C and compile it to Webassembly for faster performance. But software engineers predominantly working with Javascript may not have the expertise in languages like C/C++ and Rust and it is not ideal to learn another language to harness the benefits of Webassembly. This is why Assemblyscript was developed [3]. It is a strict subset of Typescript that compiles down to Webassembly, allowing developers to improve the performance of their application without having to become proficient in another language. Since the benchmarks for analyzing the performance of Assemblyscript for computationally intensive tasks are limited, that will be the contribution of this paper. In this study, five scientific computing problems will be used to measure and analyze the relative performance of Webassembly (compiled from Assemblyscript) and Javascript. 2 CHAPTER 2. Related Work Since its inception in 1995 to be used as glue code within HTML, Javascript has become a widespread language being used across client side web applications, server side applications, mobile applications, and even desktop applications. 2.1 Javascript Performance The increasing use of Javascript has prompted web browser developers to make significant improvements in Javascript compilers and engines over the years [4,5]. Modern browser engines make use of JIT (Just-in-time) compilers [6,7] to achieve optimizations while executing Javascript. In 2014, the performance of these engines was recorded to be close to 1.5-2 times that of native code [8]. The continuous evolution and improvement of these engines has made it possible for developers to build more complex applications in Javascript. Browsers are being used for computationally intensive tasks like numerical computing, cryptocurrency mining, and even machine learning and AI applications [9,10]. The web has also become a target for graphics and game development over the last two decades due to the advancements made in browser engines [11{13]. Since providing users with a seamless user experience in any web application is crucial, research has been done to analyze and benchmark the performance of different graphics rendering techniques [14{17]. Additional efforts have been made to improve the performance of intensive Javascript applications and to avoid common pitfalls [18, 19]. A new specification that allowed Javascript as a compilation target for low level languages like C and C++ called asm.js emerged [20]. It is intended to have performance characteristics closer to native code. This was possible because it was a strict subset of Javascript, which allowed for ahead of time optimizations. Despite the performance improvements, asm.js inherits various Javascript issues like inconsistent performance, and overhead from parsing and 3 compiling the source. This is because asm.js needs to be transpiled to Javascript using a source- to-source compiler to run on the web. 2.2 Webassembly All these efforts eventually led to the development of Webassembly which serves as a compilation target for typed languages like C/C++ and Rust with the intention of providing near native speeds [2]. Currently, the Emscripten toolchain built using LLVM [21, 22] compiles C and C++ to Webassembly, essentially enabling developers to run C and C++ in browsers. Binaryen is another compiler that allows developers to compile Assemblyscript to Webassembly [3,23]. Similar compilers exist to cross compile Javascript or Typescript to Webassembly [24]. Webassembly is already faster and smaller than asm.js, and will only improve with features like multi-threading and SIMD support in development [25{27]. 2.3 Benchmarks To properly understand the performance benefits of using Webassembly, existing or new bench- marks will have to be utilized. Octane, Kraken, and Speedometer are suites provided by browser vendors to test the performance of browser engines [28{30]. Octane is no longer being maintained. In addition to Speedometer, the Webkit team has also created JetStream2 [30], a suite that also contains some benchmark tests on Webassembly. JSBench [31] suggests that benchmarks may not accurately measure the performance of real world applications and instead introduces a technique to generate benchmarks based on popular websites that match the behavior of real world applications. This was one of the major reasons why the Chrome V8 team retired octane, as micro-benchmarks were not a good representation of how browsers will perform while running modern web applica- tions [28]. The Ostrich benchmark suite developed in the Sable lab at McGill University contains a set of 12 numerical computing problems [32] implemented in Javascript and C. Another bench- mark suite was developed [33] using the Ostrich suite to compare the performance of Webassmebly compiled from C and Javascript.
Recommended publications
  • Differential Fuzzing the Webassembly
    Master’s Programme in Security and Cloud Computing Differential Fuzzing the WebAssembly Master’s Thesis Gilang Mentari Hamidy MASTER’S THESIS Aalto University - EURECOM MASTER’STHESIS 2020 Differential Fuzzing the WebAssembly Fuzzing Différentiel le WebAssembly Gilang Mentari Hamidy This thesis is a public document and does not contain any confidential information. Cette thèse est un document public et ne contient aucun information confidentielle. Thesis submitted in partial fulfillment of the requirements for the degree of Master of Science in Technology. Antibes, 27 July 2020 Supervisor: Prof. Davide Balzarotti, EURECOM Co-Supervisor: Prof. Jan-Erik Ekberg, Aalto University Copyright © 2020 Gilang Mentari Hamidy Aalto University - School of Science EURECOM Master’s Programme in Security and Cloud Computing Abstract Author Gilang Mentari Hamidy Title Differential Fuzzing the WebAssembly School School of Science Degree programme Master of Science Major Security and Cloud Computing (SECCLO) Code SCI3084 Supervisor Prof. Davide Balzarotti, EURECOM Prof. Jan-Erik Ekberg, Aalto University Level Master’s thesis Date 27 July 2020 Pages 133 Language English Abstract WebAssembly, colloquially known as Wasm, is a specification for an intermediate representation that is suitable for the web environment, particularly in the client-side. It provides a machine abstraction and hardware-agnostic instruction sets, where a high-level programming language can target the compilation to the Wasm instead of specific hardware architecture. The JavaScript engine implements the Wasm specification and recompiles the Wasm instruction to the target machine instruction where the program is executed. Technically, Wasm is similar to a popular virtual machine bytecode, such as Java Virtual Machine (JVM) or Microsoft Intermediate Language (MSIL).
    [Show full text]
  • Interaction Between Web Browsers and Script Engines
    IT 12 058 Examensarbete 45 hp November 2012 Interaction between web browsers and script engines Xiaoyu Zhuang Institutionen för informationsteknologi Department of Information Technology Abstract Interaction between web browser and the script engine Xiaoyu Zhuang Teknisk- naturvetenskaplig fakultet UTH-enheten Web browser plays an important part of internet experience and JavaScript is the most popular programming language as a client side script to build an active and Besöksadress: advance end user experience. The script engine which executes JavaScript needs to Ångströmlaboratoriet Lägerhyddsvägen 1 interact with web browser to get access to its DOM elements and other host objects. Hus 4, Plan 0 Browser from host side needs to initialize the script engine and dispatch script source code to the engine side. Postadress: This thesis studies the interaction between the script engine and its host browser. Box 536 751 21 Uppsala The shell where the engine address to make calls towards outside is called hosting layer. This report mainly discussed what operations could appear in this layer and Telefon: designed testing cases to validate if the browser is robust and reliable regarding 018 – 471 30 03 hosting operations. Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student Handledare: Elena Boris Ämnesgranskare: Justin Pearson Examinator: Lisa Kaati IT 12 058 Tryckt av: Reprocentralen ITC Contents 1. Introduction................................................................................................................................
    [Show full text]
  • Emscripten: an LLVM to Javascript Compiler
    Emscripten: An LLVM to JavaScript Compiler Alon Zakai Mozilla What? Why? Compiling to JavaScript ● The web is everywhere – PCs to iPads – No plugins, no installation required – Built on standards ● The web runs JavaScript Existing Compilers to JavaScript ● Google Web Toolkit: Java (Gmail, etc.) ● CoffeeScript ● Pyjamas: Python ● SCM2JS: Scheme ● JSIL: .NET bytecode ● (and many more) ● But C and C++ are missing! Emscripten ● Enables compiling C and C++ into JavaScript ● Written in JavaScript ● Open source http://emscripten.org https://github.com/kripken/emscripten Demos! ● Bullet ● SQLite ● Python, Ruby, Lua ● Real-world code – Large, complex codebases ● Manual ports exist – Typically partial and not up to date The Big Picture C or C++ LLVM Bitcode JavaScript Low Level Virtual Machine (LLVM) ● A compiler project (cf. GCC) ● Intermediate Representation: LLVM bitcode – Very well documented – Great tools ● Much easier to compile LLVM bitcode than compile C or C++ directly! How? Code Comparison #include <stdio.h> int main() { printf(“hello, world!\n”); return 0; } Code Comparison @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 define i32 @main() { entry: %retval = alloca i32, align 4 call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) store i32 0, i32* %retval ret i32 %retval } Code Comparison define i32 @main() { function _main() { entry: %retval = alloca i32, var _retval; align 4 call i32 (i8*, ...)* _printf (..); @printf (..) store i32 0, i32* _retval = 0; %retval ret
    [Show full text]
  • Machine Learning in the Browser
    Machine Learning in the Browser The Harvard community has made this article openly available. Please share how this access benefits you. Your story matters Citable link http://nrs.harvard.edu/urn-3:HUL.InstRepos:38811507 Terms of Use This article was downloaded from Harvard University’s DASH repository, and is made available under the terms and conditions applicable to Other Posted Material, as set forth at http:// nrs.harvard.edu/urn-3:HUL.InstRepos:dash.current.terms-of- use#LAA Machine Learning in the Browser a thesis presented by Tomas Reimers to The Department of Computer Science in partial fulfillment of the requirements for the degree of Bachelor of Arts in the subject of Computer Science Harvard University Cambridge, Massachusetts March 2017 Contents 1 Introduction 3 1.1 Background . .3 1.2 Motivation . .4 1.2.1 Privacy . .4 1.2.2 Unavailable Server . .4 1.2.3 Simple, Self-Contained Demos . .5 1.3 Challenges . .5 1.3.1 Performance . .5 1.3.2 Poor Generality . .7 1.3.3 Manual Implementation in JavaScript . .7 2 The TensorFlow Architecture 7 2.1 TensorFlow's API . .7 2.2 TensorFlow's Implementation . .9 2.3 Portability . .9 3 Compiling TensorFlow into JavaScript 10 3.1 Motivation to Compile . 10 3.2 Background on Emscripten . 10 3.2.1 Build Process . 12 3.2.2 Dependencies . 12 3.2.3 Bitness Assumptions . 13 3.2.4 Concurrency Model . 13 3.3 Experiences . 14 4 Results 15 4.1 Benchmarks . 15 4.2 Library Size . 16 4.3 WebAssembly . 17 5 Developer Experience 17 5.1 Universal Graph Runner .
    [Show full text]
  • Javascript API Deprecation in the Wild: a First Assessment
    JavaScript API Deprecation in the Wild: A First Assessment Romulo Nascimento, Aline Brito, Andre Hora, Eduardo Figueiredo Department of Computer Science Federal University of Minas Gerais, Brazil romulonascimento, alinebrito, andrehora,figueiredo @dcc.ufmg.br { } Abstract—Building an application using third-party libraries of our knowledge, there are no detailed studies regarding API is a common practice in software development. As any other deprecation in the JavaScript ecosystem. software system, code libraries and their APIs evolve over JavaScript has become extremely popular over the last years. time. In order to help version migration and ensure backward According to the Stack Overflow 2019 Developer Survey1, compatibility, a recommended practice during development is to deprecate API. Although studies have been conducted to JavaScript is the most popular programming language in this investigate deprecation in some programming languages, such as platform for the seventh consecutive year. GitHub also reports Java and C#, there are no detailed studies on API deprecation that JavaScript is the most popular language in terms of unique in the JavaScript ecosystem. This paper provides an initial contributors to both public and private repositories2. The npm assessment of API deprecation in JavaScript by analyzing 50 platform, the largest JavaScript package manager, states on popular software projects. Initial results suggest that the use of 3 deprecation mechanisms in JavaScript packages is low. However, their latest survey that 99% of JavaScript developers rely on wefindfive different ways that developers use to deprecate API npm to ease the management of their project dependencies. in the studied projects. Among these solutions, deprecation utility This survey also points out the massive growth in npm usage (i.e., any sort of function specially written to aid deprecation) and that started about 5 years ago.
    [Show full text]
  • Webcl for Hardware-Accelerated Web Applications
    WebCL for Hardware-Accelerated Web Applications Won Jeon, Tasneem Brutch, and Simon Gibbs What is WebCL? • WebCL is a JavaScript binding to OpenCL. • WebCL enables significant acceleration of compute-intensive web applications. • WebCL currently being standardized by Khronos. 2 tizen.org Contents • Introduction – Motivation and goals – OpenCL • WebCL – Demos – Programming WebCL – Samsung’s Prototype: implementation & performance • Standardization – Khronos WebCL Working Group – WebCL robustness and security – Standardization status • Conclusion – Summary and Resources 3 tizen.org Motivation • New mobile apps with high compute demands: – augmented reality – video processing – computational photography – 3D games 4 tizen.org Motivation… • GPU offers improved FLOPS and FLOPS/watt as compared to CPU. FLOPS/ GPU watt CPU year 5 tizen.org Motivation… • Web-centric platforms 6 tizen.org OpenCL: Overview • Features – C-based cross-platform programming interface – Kernels: subset of ISO C99 with language extensions – Run-time or build-time compilation of kernels – Well-defined numerical accuracy (IEEE 754 rounding with specified maximum error) – Rich set of built-in functions: cross, dot, sin, cos, pow, log … 7 tizen.org OpenCL: Platform Model • A host is connected to one or more OpenCL devices • OpenCL device – A collection of one or more compute units (~ cores) – A compute unit is composed of one or more processing elements (~ threads) – Processing elements execute code as SIMD or SPMD 8 tizen.org OpenCL: Execution Model • Kernel – Basic unit
    [Show full text]
  • Redalyc.NEW WEB TECHNOLOGIES for ASTRONOMY
    Revista Mexicana de Astronomía y Astrofísica ISSN: 0185-1101 [email protected] Instituto de Astronomía México Sprimont, P-G.; Ricci, D.; Nicastro, L. NEW WEB TECHNOLOGIES FOR ASTRONOMY Revista Mexicana de Astronomía y Astrofísica, vol. 45, 2014, pp. 75-78 Instituto de Astronomía Distrito Federal, México Available in: http://www.redalyc.org/articulo.oa?id=57132995026 How to cite Complete issue Scientific Information System More information about this article Network of Scientific Journals from Latin America, the Caribbean, Spain and Portugal Journal's homepage in redalyc.org Non-profit academic project, developed under the open access initiative RevMexAA (Serie de Conferencias) , 45 , 75–78 (2014) NEW WEB TECHNOLOGIES FOR ASTRONOMY P-G. Sprimont, 1 D. Ricci, 2 and L. Nicastro 1 RESUMEN Gracias a las nuevas capacidades de HTML5, y las grandes mejoras del lenguaje JavaScript es posible disen˜ar interfaces web muy complejas e interactivas. Adem´as, los servidores que eran una vez monol´ıticos y orientados a servir archivos, est´an evolucionando a aplicaciones de servidor f´acilmente programables, capaces de lidiar con interacciones complejas gracias a la nueva generaci´onde navegadores. Nosotros creemos que la comunidad de astr´onomos profesionales y aficionados entera puede beneficiarse del potencial de estas nuevas tecnolog´ıas. Nuevas interfaces web pueden ser disen˜adas para proveer al usuario con herramientas mucho m´as intuitivas e interactivas. Acceder a archivos de datos astron´omicos, controlar y monitorear observatorios y en particu- lar telescopios rob´oticos, supervisar pipelines de reducci´on de datos, son todas capacidades que pueden ser imp lementadas en una aplicaci´on web JavaScript.
    [Show full text]
  • Webassembly a New World of Native Exploits on the Web Agenda
    WebAssembly A New World Of Native Exploits On The Web Agenda • Introduction • The WebAssembly Platform • Emscripten • Possible Exploit Scenarios • Conclusion Wasm: What is it good for? ● Archive.org web emulators ● Image/processing ● Video Games ● 3D Modeling ● Cryptography Libraries ● Desktop Application Ports Wasm: Crazy Incoming ● Browsix, jslinux ● Runtime.js (Node), Nebulet ● Cervus ● eWASM Java Applet Joke Slide ● Sandboxed ● Virtual Machine, runs its own instruction set ● Runs in your browser ● Write once, run anywhere ● In the future, will be embedded in other targets What Is WebAssembly? ● A relatively small set of low-level instructions ○ Instructions are executed by browsers ● Native code can be compiled into WebAssembly ○ Allows web developers to take their native C/C++ code to the browser ■ Or Rust, or Go, or anything else that can compile to Wasm ○ Improved Performance Over JavaScript ● Already widely supported in the latest versions of all major browsers ○ Not limited to running in browsers, Wasm could be anywhere Wasm: A Stack Machine Text Format Example Linear Memory Model Subtitle Function Pointers Wasm in the Browser ● Wasm doesn’t have access to memory, DOM, etc. ● Wasm functions can be exported to be callable from JS ● JS functions can be imported into Wasm ● Wasm’s linear memory is a JS resizable ArrayBuffer ● Memory can be shared across instances of Wasm ● Tables are accessible via JS, or can be shared to other instances of Wasm Demo: Wasm in a nutshell Emscripten ● Emscripten is an SDK that compiles C/C++ into .wasm binaries ● LLVM/Clang derivative ● Includes built-in C libraries, etc. ● Also produces JS and HTML code to allow easy integration into a site.
    [Show full text]
  • Learning Javascript Design Patterns
    Learning JavaScript Design Patterns Addy Osmani Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Learning JavaScript Design Patterns by Addy Osmani Copyright © 2012 Addy Osmani. All rights reserved. Revision History for the : 2012-05-01 Early release revision 1 See http://oreilly.com/catalog/errata.csp?isbn=9781449331818 for release details. ISBN: 978-1-449-33181-8 1335906805 Table of Contents Preface ..................................................................... ix 1. Introduction ........................................................... 1 2. What is a Pattern? ...................................................... 3 We already use patterns everyday 4 3. 'Pattern'-ity Testing, Proto-Patterns & The Rule Of Three ...................... 7 4. The Structure Of A Design Pattern ......................................... 9 5. Writing Design Patterns ................................................. 11 6. Anti-Patterns ......................................................... 13 7. Categories Of Design Pattern ............................................ 15 Creational Design Patterns 15 Structural Design Patterns 16 Behavioral Design Patterns 16 8. Design Pattern Categorization ........................................... 17 A brief note on classes 17 9. JavaScript Design Patterns .............................................. 21 The Creational Pattern 22 The Constructor Pattern 23 Basic Constructors 23 Constructors With Prototypes 24 The Singleton Pattern 24 The Module Pattern 27 iii Modules 27 Object Literals 27 The Module Pattern
    [Show full text]
  • Javascript to Webassembly Cross Compiler Studienarbeit
    JavaScript to WebAssembly Cross Compiler Studienarbeit Abteilung Informatik Hochschule für Technik Rapperswil Herbstsemester 2018 Autoren: Matteo Kamm, Mike Marti Betreuer: Prof. Dr. Luc Bläser Projektpartner: Institute for Networked Solutions Inhaltsverzeichnis 1 Abstract 3 2 Einführung 4 2.1 Ausgangslage . .4 2.2 Übersicht . .5 2.2.1 Beispiel . .6 2.3 Struktur des Berichts . .7 3 Language Set 8 3.1 Grundsatz des Subsets . .8 3.2 Typen . .9 3.3 Unterstützte Sprachkonstrukte . .9 4 Cross Compilation 11 4.1 Typinferenz . 11 4.2 Template-Based Code Generation . 11 4.2.1 Unäre Operatoren . 12 4.2.2 Binäre Operationen . 12 4.2.3 Expression Statements . 13 4.2.4 Arrayzugriffe . 13 4.3 Control Flow . 15 4.3.1 Block Statement . 15 4.3.2 Branching . 15 4.3.3 While-Loop . 17 4.3.4 For-Loop . 19 4.4 Variablen-Allokation . 19 4.5 Funktionsaufrufe . 20 5 Laufzeitunterstützung 21 5.1 Prüfen der Funktionssignatur . 21 5.2 Kopieren der Array Parameter . 21 5.3 Konvertieren des zurückgegebenen Resultats . 21 5.4 Out Parameter . 21 5.5 Speicher . 22 5.5.1 Import . 22 5.5.2 Export . 22 6 Auswertung 23 6.1 Testfälle . 23 6.2 Setup . 23 6.3 Resultate . 24 6.3.1 Speedup . 24 6.3.2 Varianz . 26 6.3.3 Vergleich zu C++ . 27 6.3.4 Webpack Development Modus . 28 6.4 Fazit . 28 7 Schlussfolgerung 29 7.1 Ausblick . 29 1 Anhang 30 A Erläuterung Language Set 30 A.1 Typen . 30 A.2 Numerische Erweiterung . 30 A.3 Abweichungen der binären Operatoren zu JavaScript .
    [Show full text]
  • Hi, My Name Is Chad Ausen, Technical Director at IMVU, and Today We're Go
    Hi, my name is Chad Aus0n, technical director at IMVU, and today we’re going to talk about a library we’ve developed for connec0ng C++ and JavaScript with Emscripten. 1 2 IMVU is an online social plaorm where you can sign up, dress up an avatar, and meet people from all around the world. We offer other ac0vi0es such as games as well. 3 The content in our world is created by our customers, and to our knowledge, we have the largest catalog of 3D virtual goods on the Internet. 4 We currently offer a downloadable applicaon for Windows and Mac. Windows and Mac are great plaorms, but in recent years, other plaorms have grown to prominence. We’d like our content available everywhere: mobile plaorms, desktop, server-side renderers, and even the web browser! For almost all plaorms, it’s obvious that C++ is a great choice for the core engine. However, our big ques0on was, what about the web browser? In 2011, I benchmarked an upcoming tool called Emscripten and was quite impressed. 5 Emscripten works very well in prac0ce, so the implicaon is that C++ is the portable, high-performance language EVERYWHERE. 6 Here is our Emscripten applicaon running in Firefox. UI is HTML and CSS. Chat over WebSockets, graphics in WebGL. 7 asm.js is the subset of JavaScript that can be stacally compiled into machine code. More informaon at h`p://asmjs.org/ 8 The C heap is stored in an ArrayBuffer in JavaScript. One con0guous blob of memory. This memory is indexed by eight different typed array views that alias each other.
    [Show full text]
  • Webgl, Webcl and Beyond!
    WebGL, WebCL and Beyond! Neil Trevett VP Mobile Content, NVIDIA President, Khronos Group © Copyright Khronos Group, 2011 - Page 1 Two WebGL-focused Sessions Today • Industry ecosystem and standards for 3D and compute - What is 3D anyway – jungle survival primer - Khronos and open standard acceleration APIs for native apps - The evolution of pervasive 3D on mobile platforms - WebGL and WebCL as part of HTML5 - Web apps and use cases beyond games – augmented reality • Hands-On with WebGL - Steve Baker - Intific WebGL Reference Cards at end of session! © Copyright Khronos Group, 2011 - Page 2 What is Real-time 3D Graphics? © Copyright Khronos Group, 2011 - Page 3 3D Pipeline Basics • The art of “faking” realistic looking scenes or objects using heuristic techniques learned over the years • The objects making up a scene are held in a database • Surfaces of objects are broken down into a grid of polygons • The vertices of the polygons are located in 3D coordinate space - x,y,z • Each vertex has a “material” – color and reflective properties • Vertices are positioned in 3D space – matrix math zooms and rotates y x2,y2,z2 x1,y1,z1 z x3,y3,z3 x © Copyright Khronos Group, 2011 - Page 4 3D Pipeline Basics – Pixel Shading • Project each polygon onto the screen Interpolate colors - Determine which pixels are affected between vertices • Smooth Shading Lighting - Run lighting equation at each vertex equation each - Compute vertex color depending vertex on how lights interact with surface angles and properties - Interpolate colors between the vertices
    [Show full text]