SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
asm.js
전용우
asm.js란?
• 성능을 높일 수 있는 자바스크립트 서브셋
JavaScript
asm.js
TypeScript
superset
subset
왜 asm.js가 HOT한가?
• Mozilla와 Epic이 Unreal Engine3을 포팅
Unreal Engine3의 포팅 process
C++
IR Link
JS
WebGL
EMScripten
LLVMClang
asm.js
asm.js
function DiagModule(stdlib, foreign, heap) {
"use asm";
// Variable Declarations
var sqrt = stdlib.Math.sqrt;
// Function Declarations
function square(x) {
x = +x;
return +(x*x);
}
function diag(x, y) {
x = +x; y = +y;
return +sqrt(square(x) + square(y));
}
return { diag: diag };
}
Math WebGL heap
var diag = DiagModule({ Math: Math }).diag;
alert(diag(10, 100));
asm.js의 특징
• 모든 브라우저에서 동작
• 제한된 타입(숫자)만 가능 (링크)
• 직접 heap을 만들어서 메모리 관리 (링크)
왜 성능이 좋은가?
• 고정타입
– e|0 (integer), +a(double)
– 엔진에서는 “use asm”이라고 되어 있으면
타입이 정적이라고 판단하여 AOT
컴파일(ahead-of-time compile)함.
• 메모리를 직접 관리
– heap을 구현하여 malloc과 free와 유사하게 관리
그럼, 만들어 볼까요?
function asmTest(){
"use asm";
}
asm.js는 사람이 개발하는 코드가 아님
asm.js는 주로 컴파일 된 코드
emscripten
LLJS
CoffeeScript
TypeScript
Dart
asm.js
pyjamas
GWT
Script#
한계
• 여전히 느린 성능
• 웹 개발하고는 거의 상관없음
• 굉장히 static함
• 개발과 디버깅 언어가 다름
• 결과가 JS일뿐 바이트 코드에 가깝다
• 차라리 JS개발의 성능을 올리는 게 좋다
차세대 웹 게임의 가능성을 보여줌
감사합니다
Resource
• http://ejohn.org/blog/asmjs-javascript-compile-target/
• http://kripken.github.io/mloc_emscripten_talk
• http://gigazine.net/news/20130322-firefox-asmjs/
• https://blog.mozilla.org/luke/2013/03/21/asm-js-in-firefox-nightly/
• http://kripken.github.io/ammo.js/examples/new/ammo.html
• http://jlongster.com/Compiling-LLJS-to-asm.js,-Now-Available-
• http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly
• https://github.com/tonyg/js-nacl#readme
• http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html
• https://news.ycombinator.com/item?id=5456506
• https://news.ycombinator.com/item?id=5455045
• https://twitter.com/mraleph/status/317230108849098752
• http://mbebenita.github.io/LLJS/
• https://news.ycombinator.com/item?id=5486605
• https://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/
• http://kripken.github.io/mloc_emscripten_talk/gindex.html
• http://engineering.imvu.com/2013/04/05/multiplatform-c-on-the-web-with-emscripten/
• http://blog.brackets.io/2013/04/05/typeaware-javascript-code-intelligence/

Weitere ähnliche Inhalte

Ähnlich wie asm.js

[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기현철 조
 
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로Oracle Korea
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedWeb Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedJungsu Heo
 
EcmaScript6(2015) Overview
EcmaScript6(2015) OverviewEcmaScript6(2015) Overview
EcmaScript6(2015) Overviewyongwoo Jeon
 
ECMAScript 6의 새로운 것들!
ECMAScript 6의 새로운 것들!ECMAScript 6의 새로운 것들!
ECMAScript 6의 새로운 것들!WooYoung Cho
 
함수형 사고 - Functional thinking
함수형 사고 - Functional thinking함수형 사고 - Functional thinking
함수형 사고 - Functional thinking재문 심
 
20131217 html5
20131217 html520131217 html5
20131217 html5DK Lee
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs기동 이
 
Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트Jin wook
 
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발정석 양
 
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018Amazon Web Services Korea
 
Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Gruter
 
11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템noerror
 
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)Amazon Web Services Korea
 

Ähnlich wie asm.js (20)

ES6 for Node.js Study 2주차
ES6 for Node.js Study 2주차ES6 for Node.js Study 2주차
ES6 for Node.js Study 2주차
 
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
 
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로
[Main Session] 미래의 Java 미리보기 - 앰버와 발할라 프로젝트를 중심으로
 
Java.next
Java.nextJava.next
Java.next
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedWeb Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
 
EcmaScript6(2015) Overview
EcmaScript6(2015) OverviewEcmaScript6(2015) Overview
EcmaScript6(2015) Overview
 
JDK 변천사
JDK 변천사JDK 변천사
JDK 변천사
 
Html5 performance
Html5 performanceHtml5 performance
Html5 performance
 
ECMAScript 6의 새로운 것들!
ECMAScript 6의 새로운 것들!ECMAScript 6의 새로운 것들!
ECMAScript 6의 새로운 것들!
 
함수형 사고 - Functional thinking
함수형 사고 - Functional thinking함수형 사고 - Functional thinking
함수형 사고 - Functional thinking
 
Rx java essentials
Rx java essentialsRx java essentials
Rx java essentials
 
20131217 html5
20131217 html520131217 html5
20131217 html5
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs
 
Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트
 
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발
[하코사세미나]미리보는 대규모 자바스크립트 어플리케이션 개발
 
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018
실전! AWS 기반 데이터베이스 마이그레이션::최홍식::AWS Summit Seoul 2018
 
Nexacro
NexacroNexacro
Nexacro
 
Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014
 
11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템11_빠른 개발 가능한 레벨 편집 시스템
11_빠른 개발 가능한 레벨 편집 시스템
 
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
 

Mehr von yongwoo Jeon

Web Components 101 polymer & brick
Web Components 101 polymer & brickWeb Components 101 polymer & brick
Web Components 101 polymer & brickyongwoo Jeon
 
Html5 시대의 웹앱 프로그래밍 방식의 변화
Html5 시대의 웹앱 프로그래밍 방식의 변화Html5 시대의 웹앱 프로그래밍 방식의 변화
Html5 시대의 웹앱 프로그래밍 방식의 변화yongwoo Jeon
 
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지Html5 앱과 웹사이트를 보다 빠르게 하는 50가지
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지yongwoo Jeon
 
모바일 디버깅
모바일 디버깅모바일 디버깅
모바일 디버깅yongwoo Jeon
 
Client side storage in html5
Client side storage in html5Client side storage in html5
Client side storage in html5yongwoo Jeon
 

Mehr von yongwoo Jeon (13)

deview2014
deview2014deview2014
deview2014
 
Web notification
Web notificationWeb notification
Web notification
 
Web Components 101 polymer & brick
Web Components 101 polymer & brickWeb Components 101 polymer & brick
Web Components 101 polymer & brick
 
Html5 시대의 웹앱 프로그래밍 방식의 변화
Html5 시대의 웹앱 프로그래밍 방식의 변화Html5 시대의 웹앱 프로그래밍 방식의 변화
Html5 시대의 웹앱 프로그래밍 방식의 변화
 
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지Html5 앱과 웹사이트를 보다 빠르게 하는 50가지
Html5 앱과 웹사이트를 보다 빠르게 하는 50가지
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
모바일 디버깅
모바일 디버깅모바일 디버깅
모바일 디버깅
 
Web component
Web componentWeb component
Web component
 
Html5 use cases
Html5 use casesHtml5 use cases
Html5 use cases
 
Client side storage in html5
Client side storage in html5Client side storage in html5
Client side storage in html5
 
Devfest
DevfestDevfest
Devfest
 
Scriptable cache
Scriptable cacheScriptable cache
Scriptable cache
 
Whats jindo
Whats jindoWhats jindo
Whats jindo
 

asm.js

  • 2. asm.js란? • 성능을 높일 수 있는 자바스크립트 서브셋 JavaScript asm.js TypeScript superset subset
  • 3. 왜 asm.js가 HOT한가? • Mozilla와 Epic이 Unreal Engine3을 포팅
  • 4. Unreal Engine3의 포팅 process C++ IR Link JS WebGL EMScripten LLVMClang asm.js
  • 6. function DiagModule(stdlib, foreign, heap) { "use asm"; // Variable Declarations var sqrt = stdlib.Math.sqrt; // Function Declarations function square(x) { x = +x; return +(x*x); } function diag(x, y) { x = +x; y = +y; return +sqrt(square(x) + square(y)); } return { diag: diag }; } Math WebGL heap var diag = DiagModule({ Math: Math }).diag; alert(diag(10, 100));
  • 7. asm.js의 특징 • 모든 브라우저에서 동작 • 제한된 타입(숫자)만 가능 (링크) • 직접 heap을 만들어서 메모리 관리 (링크)
  • 8. 왜 성능이 좋은가? • 고정타입 – e|0 (integer), +a(double) – 엔진에서는 “use asm”이라고 되어 있으면 타입이 정적이라고 판단하여 AOT 컴파일(ahead-of-time compile)함. • 메모리를 직접 관리 – heap을 구현하여 malloc과 free와 유사하게 관리
  • 9.
  • 10. 그럼, 만들어 볼까요? function asmTest(){ "use asm"; }
  • 12. asm.js는 주로 컴파일 된 코드 emscripten LLJS CoffeeScript TypeScript Dart asm.js pyjamas GWT Script#
  • 13. 한계 • 여전히 느린 성능 • 웹 개발하고는 거의 상관없음 • 굉장히 static함 • 개발과 디버깅 언어가 다름 • 결과가 JS일뿐 바이트 코드에 가깝다 • 차라리 JS개발의 성능을 올리는 게 좋다
  • 14. 차세대 웹 게임의 가능성을 보여줌
  • 16. Resource • http://ejohn.org/blog/asmjs-javascript-compile-target/ • http://kripken.github.io/mloc_emscripten_talk • http://gigazine.net/news/20130322-firefox-asmjs/ • https://blog.mozilla.org/luke/2013/03/21/asm-js-in-firefox-nightly/ • http://kripken.github.io/ammo.js/examples/new/ammo.html • http://jlongster.com/Compiling-LLJS-to-asm.js,-Now-Available- • http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly • https://github.com/tonyg/js-nacl#readme • http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html • https://news.ycombinator.com/item?id=5456506 • https://news.ycombinator.com/item?id=5455045 • https://twitter.com/mraleph/status/317230108849098752 • http://mbebenita.github.io/LLJS/ • https://news.ycombinator.com/item?id=5486605 • https://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/ • http://kripken.github.io/mloc_emscripten_talk/gindex.html • http://engineering.imvu.com/2013/04/05/multiplatform-c-on-the-web-with-emscripten/ • http://blog.brackets.io/2013/04/05/typeaware-javascript-code-intelligence/