Skip to content

Instantly share code, notes, and snippets.

@chikoski
Last active September 28, 2016 00:58
Show Gist options
  • Save chikoski/9ea4d502ec5798664a10c54d636674b4 to your computer and use it in GitHub Desktop.
Save chikoski/9ea4d502ec5798664a10c54d636674b4 to your computer and use it in GitHub Desktop.
Talk outlines for Emscripten Night!! (http://connpass.com/event/40564/)

WebAssembly: a new virtual machine for the Web

Recent years, we are building large scaled apps with Web technlogies. They consist of more millions lines of JavaScript code and various kind of assets to be managed by JS programs. This trend has continued since re-discovery of AJAX and Web APIs' evolution accelerate it.

In this context, we need the technologies which allows us to build and run such large scaled Web apps efficiently. asm.js and WebAssembly (WASM) are key technologes for it. asm.js is a simplified subset of JavaScript, which offers us near native speed code execution on the Web browers. WASM is a portable and size / loadtime effective binary format for browsers to generate native codes, of which capabilities are equivalent to asm.js code fr now. These are too complicated to be hand-written, so we will generate them with compilers.

Emscripten is the most famous tool to generate asm.js / WASM. It is a tool based on LLVM, so we can build programms running on the top of web browsers, which are written in C / C++. This means not only that we can port C / C++ to the Web easily, but also we can utlize C / C++ developers' knowledge and tools to develop web apps.

In this talk, we will overview these fundamental technlogies: asm.js, WASM, and Emscripten. We will look the background to introduce these technolgies, as well as their current status. We will also close look at WASM specs.

WebAssembly: a new virtual machine for the Web

ウェブとブラウザが、本格的なアプリケーションプラットフォームとして扱われ始めて随分とたちます。 それは AJAX の再発見に始まり、HTML5 ブームと Web API の充実によって支えられ、 現在まで至っています。そんな中、必要とされ始めてきているのは、大規模アプリケーションの作成と実行の環境です。 TypeScript のような型付きの altJS が必要とされているのも、 大規模なアプリケーションを安全に記述したいという要求からでしょう。

そんな中、大規模なアプリケーションの作成と実行を可能にする技術として注目され始めているのが、 asm.js と WebAssembly (WASM) です。前者はネイティブに近いスピードでの実行を可能にするための言語で、 後者はロード時間の短縮を可能にするファイルフォーマットです。 これらはプログラマーが文芸的に記述することを想定しておらず、 C や C++ に代表されるネイティブ向けのコードを変換し、 生成されることが普通です。 この変換に利用される代表的なツールは Emscripten でしょう。 LLVM を利用したこのツールは、LLVM IR を asm.js / WASM へと変換します。 これらの技術は、ネイティブ向けのコードのウェブへの容易な移植を可能にするに止まらず、 蓄積された大規模アプリケーション作成のための知見とツールを Web でも利用可能になることを意味します。

本講演では WebAssembly を中心に、大規模アプリケーションの実行に耐えうる環境を提供するための基盤技術について、 その背景と仕様を概観します。また既存の Web 技術との連携方法や、 現状についても確認します。この講演で ウェブのアプリケーションプラットフォームとしての潜在能力を感じていただければ幸いです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment