SlideShare a Scribd company logo
1 of 83
Download to read offline
주요활동
2012 년 마소기고
•11 월 - Sencha Touch Class System
•12 월 - Sencha.io ( 공동기고 )
JavaScript 성능 향상과
Sencha
한국커뮤니티데이
(Korea Community Day)
Track 2, Session 2
1:50 ~ 2:30
김태원한국센차유저그룹
부운영자
SNS (Facebook)
https://www.facebook.com/mniktw
https://www.facebook.com/groups/korea.senchahttp://me.kinotl.com
Table of Contents
성능이란 무엇인가 ?
측정은 어떻게 ?
개선하기 전에 ...
방법은 ?
Sencha Fastbook...
성능이란 무엇인가 ?
정해진 시간내에서 처리할 수 있는 일의 양 !
1
람보르기니 vs 마티즈
같은 직선 거리 , 경주를 한다 ??
시간
처리한 작업의 양 !
측정은 어떻게 ?
외부의 도구 사용 .
벤치마크 자작 .
Unix, Linux $ time ~ 커맨드 .
2
외부
도구
사용하기
jsPerf
Benchmark
Code
자작
Benchamark.js
function(func) {
!== '[object Function]') { return; } try { begin = new Date(); console.log
' + (end - begin) ); return; } }})(this);
<script type="text/javascript" src="Benchamark.js"></script>
index.html
tion() { Benchemark.run(function() { // TODO: 여기에 코
index.html
Unix,Linux
$ time ~
커맨드를 활용하자 .
me node display1.jsreal 0m0.391suser 0m0.374ssys 0m0.0
terminal
- 프로그램이 시작되고 종료된 시간 .
- 사용자 모드에서 CPU 를 사용된 시간 .
- 커널 모드에서 CPU 를 사용된 시간 .
jsperf 와 같은 외부 툴 사용 .
벤치마크 코드를 직접 작성 .
유닉스 , 리눅스에 포함된
$ time 커맨드
시간이 얼마나 걸리는가
눈으로 확인하자 !
결론
개선하기 전에 ...
데이터의 양이 어느 정도인가 ?
알고리즘 효율이 어떠한가 ?
엔진의 이해도가 높은가 ?
시스템 구조에 대한 이해가 높은가 ?
코드 길이가 짧다고 빠르지 않다 ?
3
JavaScript 성능은 ?
Slow
C/C++ 보다
엄지 발가락으로 짠 C/C++ 코드 보다
JavaScript 가 느리다 .
브라우저에 포함된
자바스크립트 엔진에 따라 다른 결과 ...
방법은 ?
데이터의 양이 어느 정도인가 ?
알고리즘 효율이 어떠한가 ?
엔진의 이해도가 높은가 ?
시스템 구조에 대한 이해가 높은가 ?
코드 길이가 짧다고 빠르지 않다 ?
4
데이터의 양이 어느 정도인가 ?
100 개의 데이터
1000 개의 데이터
.
.
.
= 0; i < 100; i++) array[i] = i; for(var i = 0; i < 100; i++) sum += array[i];
JavaScript
var array = [], sum = 0; for(var i = 0; i < 1000; i++) array[i] = i; for(va
ee();})();
ee();})();
JavaScript
$ time node SumEx1.jsreal0m0.484suser 0m0.473ssys 0m0.014s$ time node SumEx2.jsreal0m3.310suser 0m3.305ssys 0m0.039s
알고리즘 효율이 어떠한가 ?
JavaScript JavaScript
if(array[i] === value) result = i; return result; } var array = []; for(var i = 0; i < 1000; i++) array
200000; i++) result = indexOf( array, 1 );})();
200000; i++) result = indexOf( array, 1 );})();
i = 0; i < array.length; i++) if(array[i] === value) return i; } var array = []; for(var i = 0; i < 1000; i
array[i] = i; var result = 0; for(var i = 0; i < 200000; i++) result = indexOf( array, 1 );})();})();
array[i] = i; var result = 0; for(var i = 0; i < 200000; i++) result = indexOf( array, 1 );})();})();
$ time node indexOf1.js real 0m0.605suser 0m0.593ssys 0m0.013s
real 0m0.605suser 0m0.593ssys 0m0.013s
$ time node indexOf2.js real 0m0.066suser 0m0.056ssys 0m0.009s
real 0m0.066suser 0m0.056ssys 0m0.009s
버블정렬과 퀵정렬의 반복 횟수
차이 !
반복 횟수를 줄여라 .
엔진의 이해도가 높은가 ?
시스템 구조에 대한 이해가 높은가 ?
JavaScript JavaScript
ction(array) { for(var i = 0; i < 1000; i++)
ray[i] + i; } var array = []; for(var i = 0; i < 200000; i++) initArray( array );})();
r(var i = 0; i < 200000; i++) initArray( array );})();
r(var i = 0; i < 200000; i++) initArray( array );})();
(function() { var initArray = function(array) { for(var i = 0; i < 1000; i++) array[
for(var i = 0; i < 1000; i++) array[i] = 0; for(var i = 0; i < 200000; i++) initA
for(var i = 0; i < 200000; i++) initArray( array );})();
for(var i = 0; i < 200000; i++) initArray( array );})();
for(var i = 0; i < 200000; i++) initArray( array );})();
ime node initValue1.js real 0m3.592suser 0m3.581ssys 0m0.035s$ time node initValue2.js real 0m0.534suser 0m0.524ssys 0m0.0
ength; i++) sum = sum + array[i]; } var array = [];for(var i = 0; i < 1000; i++) array[i] = i;
JavaScript
sum = 0, size = array.length; for(var i = 0; i < size; i++) sum = sum + array[i]; } var array =
JavaScript
화면 출력은 , 변수에 어떤 조작보다
항상 느리다 .
JavaScript JavaScript
; i < 1000; i++) sum = sum + 1; return sum; } var result = 0; for(var i = 0; i < 200000; i++) resvar sum = 0; for(var i = 0; i < 1000; i++) sum = sum + 1; return sum; } var res
ime node display1.js1000real0m0.391suser 0m0.374ssys 0m0.018s
$ time node display2.js1000...1000 숫 자 가 20 만 번 ...real 0m4.863sus
0m0.685s
real 0m4.863suser 0m4.204ssys 0m0.685s
real 0m4.863suser 0m4.204ssys 0m0.685s
내부 동작 매커니즘에서
부당한 처리를 피해라 !
Breaking the JavaScript Speed Limit with V8
http://www.youtube.com/watch?feature=player_embedded&v=UJPdhx5zTaw#!
1 부터 25000 까지 소수
(Prime Number)
14 초 걸리던 코드 ...
CPP vs JavaScript (V8)
0.1 초
function Primes() { this.prime_count = 0;
this.primes = new Array(25000); this.getPrimeCount =
function() { return this.prime_count; }this.getPrime =
function(i) { return this.primes[i]; } this.addPrime =
function(i) { this.primes[this.prime_count+
+] = i; } this.isPrimeDivisible =
function(candidate) { for (var i = 1; i <=
this.prime_count; i++) {
if((candidate % this.primes[i]) == 0)
return true; } return
false; }};function main() { p = new Primes();
var c = 1; while(p.getPrimeCount() < 25000) {
if (!p.isPrimeDivisible(c))
p.addPrime(c); c++; }
console.log(p.getPrime(p.getPrimeCount() - 1));}main();
function Primes() { this.prime_count = 0; this.primes
= new Array(25000); this.getPrimeCount = function() { return
this.prime_count; } this.getPrime = function(i) { return
this.primes[i]; } this.addPrime = function(i) {
this.primes[this.prime_count++] = i; }
this.isPrimeDivisible = function(candidate) {
for (var i = 1; i <= this.prime_count; i++) {
var current_prime = this.primes[i]; if
(current_prime * current_prime > candidate)
return false; if( (candidate
% current_prime) == 0)
return true; } return false;
}};function main() { p = new Primes(); var c = 1;
while(p.getPrimeCount() < 25000) { if
(!p.isPrimeDivisible(c))
p.addPrime(c); c++; }
console.log(p.getPrime(p.getPrimeCount() - 1));}main();
Prime1.js Prime2.js
JavaScript 는 느리다 .
데이터 양을 제한 .
효율적인 알고리즘 선택 .
부당한 처리를 피함 .
빠르게 실행될 수 있다 .
결론
Sencha Fastbook
5
2012 년 9 월 11 일
TechCrunch Distrupt 20
Mark Zuckerberg
“지난 2 년간 가장 큰 실수는 네이티브 앱 대신에
HTML5 에 너무 많이 주력 (Betting) 했다는 것이라
생각한다
”
http://fb.html5isready.com
http://goo.gl/Lm3Ah
Questionand
Answer
감사합니다 .
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha
한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha

More Related Content

What's hot

[문디 10주차] d3.js 상호작용
[문디 10주차] d3.js  상호작용[문디 10주차] d3.js  상호작용
[문디 10주차] d3.js 상호작용YooDuck Hwang
 
자료구조5보고서
자료구조5보고서자료구조5보고서
자료구조5보고서KimChangHoen
 
2012 Ds A1 05
2012 Ds A1 052012 Ds A1 05
2012 Ds A1 05seonhyung
 
Implements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture ArrayImplements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture ArrayYEONG-CHEON YOU
 
파이썬 언어 기초
파이썬 언어 기초파이썬 언어 기초
파이썬 언어 기초beom kyun choi
 
Project#5 최단거리 찾기 D0 Hwp
Project#5 최단거리 찾기 D0 HwpProject#5 최단거리 찾기 D0 Hwp
Project#5 최단거리 찾기 D0 HwpKimjeongmoo
 
Voxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseVoxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseYEONG-CHEON YOU
 
[WEB UI BASIC] WEB Animation 1탄
[WEB UI BASIC] WEB Animation 1탄[WEB UI BASIC] WEB Animation 1탄
[WEB UI BASIC] WEB Animation 1탄Jae Woo Woo
 

What's hot (11)

[문디 10주차] d3.js 상호작용
[문디 10주차] d3.js  상호작용[문디 10주차] d3.js  상호작용
[문디 10주차] d3.js 상호작용
 
자료구조5보고서
자료구조5보고서자료구조5보고서
자료구조5보고서
 
iOS 메모리관리
iOS 메모리관리iOS 메모리관리
iOS 메모리관리
 
이산수학05
이산수학05이산수학05
이산수학05
 
[Week8]R_ggplot2
[Week8]R_ggplot2[Week8]R_ggplot2
[Week8]R_ggplot2
 
2012 Ds A1 05
2012 Ds A1 052012 Ds A1 05
2012 Ds A1 05
 
Implements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture ArrayImplements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture Array
 
파이썬 언어 기초
파이썬 언어 기초파이썬 언어 기초
파이썬 언어 기초
 
Project#5 최단거리 찾기 D0 Hwp
Project#5 최단거리 찾기 D0 HwpProject#5 최단거리 찾기 D0 Hwp
Project#5 최단거리 찾기 D0 Hwp
 
Voxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseVoxel based game_optimazation_relelase
Voxel based game_optimazation_relelase
 
[WEB UI BASIC] WEB Animation 1탄
[WEB UI BASIC] WEB Animation 1탄[WEB UI BASIC] WEB Animation 1탄
[WEB UI BASIC] WEB Animation 1탄
 

Viewers also liked

Give special attention while lighting up fireworks
Give special attention while lighting up fireworksGive special attention while lighting up fireworks
Give special attention while lighting up fireworkschris10martin
 
Why office Partitions increase Productivity ?
Why office Partitions increase Productivity ?Why office Partitions increase Productivity ?
Why office Partitions increase Productivity ?chris10martin
 
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Spacemniktw
 
The Reasons Why You are Losing Your Hair [Infographic]
The Reasons Why You are Losing Your Hair [Infographic]The Reasons Why You are Losing Your Hair [Infographic]
The Reasons Why You are Losing Your Hair [Infographic]chris10martin
 
Trabajo colaborativo wiki 4 modulo ecologia
Trabajo colaborativo wiki 4 modulo ecologiaTrabajo colaborativo wiki 4 modulo ecologia
Trabajo colaborativo wiki 4 modulo ecologiaJohn Jairo Espejo Pinto
 
Fauvismo, rayonismo, cubismo, futurismo
Fauvismo, rayonismo, cubismo, futurismoFauvismo, rayonismo, cubismo, futurismo
Fauvismo, rayonismo, cubismo, futurismobarbara_vasquez_gaete
 
Presentación tecnologias2
Presentación tecnologias2Presentación tecnologias2
Presentación tecnologias2RaquelOlivaCH
 
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDA
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDATRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDA
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDAMaria Lima
 
Plano Binásio - Insidevox
Plano Binásio - InsidevoxPlano Binásio - Insidevox
Plano Binásio - Insidevoxguest63601
 
Partes de un computador
Partes de un computadorPartes de un computador
Partes de un computadorKarlos Murillo
 
3241432814
32414328143241432814
3241432814meyates
 

Viewers also liked (20)

Give special attention while lighting up fireworks
Give special attention while lighting up fireworksGive special attention while lighting up fireworks
Give special attention while lighting up fireworks
 
Plants
PlantsPlants
Plants
 
Why office Partitions increase Productivity ?
Why office Partitions increase Productivity ?Why office Partitions increase Productivity ?
Why office Partitions increase Productivity ?
 
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space
별천지 세미나 세션 1 SenchaCon`13 이슈와 Sencha Space
 
Accident graphs
Accident graphsAccident graphs
Accident graphs
 
The Reasons Why You are Losing Your Hair [Infographic]
The Reasons Why You are Losing Your Hair [Infographic]The Reasons Why You are Losing Your Hair [Infographic]
The Reasons Why You are Losing Your Hair [Infographic]
 
Hoy aprendí
Hoy aprendíHoy aprendí
Hoy aprendí
 
EL SECRETO DEL ENAMORAMIENTO
EL SECRETO DEL ENAMORAMIENTO EL SECRETO DEL ENAMORAMIENTO
EL SECRETO DEL ENAMORAMIENTO
 
Trabajo colaborativo wiki 4 modulo ecologia
Trabajo colaborativo wiki 4 modulo ecologiaTrabajo colaborativo wiki 4 modulo ecologia
Trabajo colaborativo wiki 4 modulo ecologia
 
Fauvismo, rayonismo, cubismo, futurismo
Fauvismo, rayonismo, cubismo, futurismoFauvismo, rayonismo, cubismo, futurismo
Fauvismo, rayonismo, cubismo, futurismo
 
Presentación tecnologias2
Presentación tecnologias2Presentación tecnologias2
Presentación tecnologias2
 
EstáCio Apr 2 T08 Port
EstáCio Apr 2 T08 PortEstáCio Apr 2 T08 Port
EstáCio Apr 2 T08 Port
 
Julissa
JulissaJulissa
Julissa
 
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDA
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDATRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDA
TRABALHO REALIZADO PELA 8ªSÉRIE-PROFªTUSNELDA
 
Productos y servicios
Productos y serviciosProductos y servicios
Productos y servicios
 
Gestion del Conocimiento
Gestion del ConocimientoGestion del Conocimiento
Gestion del Conocimiento
 
Plano Binásio - Insidevox
Plano Binásio - InsidevoxPlano Binásio - Insidevox
Plano Binásio - Insidevox
 
Metodbuskeda
MetodbuskedaMetodbuskeda
Metodbuskeda
 
Partes de un computador
Partes de un computadorPartes de un computador
Partes de un computador
 
3241432814
32414328143241432814
3241432814
 

Similar to 한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha

배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlowJang Hoon
 
Pyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlabPyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlabIntae Cho
 
Droid knights android test @Droid Knights 2018
Droid knights android test @Droid Knights 2018Droid knights android test @Droid Knights 2018
Droid knights android test @Droid Knights 2018KyungHo Jung
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)NAVER D2
 
Agile Test Driven Development For Games What, Why, And How
Agile Test Driven Development For Games What, Why, And HowAgile Test Driven Development For Games What, Why, And How
Agile Test Driven Development For Games What, Why, And HowRyan Park
 
Nexon Developers Conference 2017 Functional Programming for better code - Mod...
Nexon Developers Conference 2017 Functional Programming for better code - Mod...Nexon Developers Conference 2017 Functional Programming for better code - Mod...
Nexon Developers Conference 2017 Functional Programming for better code - Mod...Isaac Jeon
 
코드리뷰 짝 매칭 프로그램 구현기
코드리뷰 짝 매칭 프로그램 구현기코드리뷰 짝 매칭 프로그램 구현기
코드리뷰 짝 매칭 프로그램 구현기Yong Hoon Kim
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 명신 김
 
[D2 오픈세미나]5.robolectric 안드로이드 테스팅
[D2 오픈세미나]5.robolectric 안드로이드 테스팅[D2 오픈세미나]5.robolectric 안드로이드 테스팅
[D2 오픈세미나]5.robolectric 안드로이드 테스팅NAVER D2
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crowJaeseung Ha
 
Spark 소개 1부
Spark 소개 1부Spark 소개 1부
Spark 소개 1부Jinho Yoo
 
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It종빈 오
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스noerror
 
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍흥배 최
 
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자Donghyeok Kang
 
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?내훈 정
 
[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기Sang Heon Lee
 
Javascript개발자의 눈으로 python 들여다보기
Javascript개발자의 눈으로 python 들여다보기Javascript개발자의 눈으로 python 들여다보기
Javascript개발자의 눈으로 python 들여다보기지수 윤
 

Similar to 한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha (20)

W14 chap13
W14 chap13W14 chap13
W14 chap13
 
배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow
 
Pyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlabPyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlab
 
Droid knights android test @Droid Knights 2018
Droid knights android test @Droid Knights 2018Droid knights android test @Droid Knights 2018
Droid knights android test @Droid Knights 2018
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)
 
Agile Test Driven Development For Games What, Why, And How
Agile Test Driven Development For Games What, Why, And HowAgile Test Driven Development For Games What, Why, And How
Agile Test Driven Development For Games What, Why, And How
 
Nexon Developers Conference 2017 Functional Programming for better code - Mod...
Nexon Developers Conference 2017 Functional Programming for better code - Mod...Nexon Developers Conference 2017 Functional Programming for better code - Mod...
Nexon Developers Conference 2017 Functional Programming for better code - Mod...
 
코드리뷰 짝 매칭 프로그램 구현기
코드리뷰 짝 매칭 프로그램 구현기코드리뷰 짝 매칭 프로그램 구현기
코드리뷰 짝 매칭 프로그램 구현기
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
 
[D2 오픈세미나]5.robolectric 안드로이드 테스팅
[D2 오픈세미나]5.robolectric 안드로이드 테스팅[D2 오픈세미나]5.robolectric 안드로이드 테스팅
[D2 오픈세미나]5.robolectric 안드로이드 테스팅
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crow
 
Spark 소개 1부
Spark 소개 1부Spark 소개 1부
Spark 소개 1부
 
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It
[WELC] 22. I Need to Change a Monster Method and I Can’t Write Tests for It
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스
 
Java8 람다
Java8 람다Java8 람다
Java8 람다
 
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
 
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자
Java Annotation과 MyBatis로 나만의 ORM Framework을 만들어보자
 
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
시즌 2: 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
 
[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기
 
Javascript개발자의 눈으로 python 들여다보기
Javascript개발자의 눈으로 python 들여다보기Javascript개발자의 눈으로 python 들여다보기
Javascript개발자의 눈으로 python 들여다보기
 

한국 커뮤니티 데이 트랙2, 세션2 JavaScript 성능향상과 Sencha

  • 1. 주요활동 2012 년 마소기고 •11 월 - Sencha Touch Class System •12 월 - Sencha.io ( 공동기고 ) JavaScript 성능 향상과 Sencha 한국커뮤니티데이 (Korea Community Day) Track 2, Session 2 1:50 ~ 2:30 김태원한국센차유저그룹 부운영자 SNS (Facebook) https://www.facebook.com/mniktw https://www.facebook.com/groups/korea.senchahttp://me.kinotl.com
  • 2. Table of Contents 성능이란 무엇인가 ? 측정은 어떻게 ? 개선하기 전에 ... 방법은 ? Sencha Fastbook...
  • 3. 성능이란 무엇인가 ? 정해진 시간내에서 처리할 수 있는 일의 양 ! 1
  • 4. 람보르기니 vs 마티즈 같은 직선 거리 , 경주를 한다 ??
  • 6. 측정은 어떻게 ? 외부의 도구 사용 . 벤치마크 자작 . Unix, Linux $ time ~ 커맨드 . 2
  • 10. Benchamark.js function(func) { !== '[object Function]') { return; } try { begin = new Date(); console.log ' + (end - begin) ); return; } }})(this);
  • 12. tion() { Benchemark.run(function() { // TODO: 여기에 코 index.html
  • 14. me node display1.jsreal 0m0.391suser 0m0.374ssys 0m0.0 terminal - 프로그램이 시작되고 종료된 시간 . - 사용자 모드에서 CPU 를 사용된 시간 . - 커널 모드에서 CPU 를 사용된 시간 .
  • 15. jsperf 와 같은 외부 툴 사용 . 벤치마크 코드를 직접 작성 . 유닉스 , 리눅스에 포함된 $ time 커맨드 시간이 얼마나 걸리는가 눈으로 확인하자 ! 결론
  • 16. 개선하기 전에 ... 데이터의 양이 어느 정도인가 ? 알고리즘 효율이 어떠한가 ? 엔진의 이해도가 높은가 ? 시스템 구조에 대한 이해가 높은가 ? 코드 길이가 짧다고 빠르지 않다 ? 3
  • 18. 엄지 발가락으로 짠 C/C++ 코드 보다 JavaScript 가 느리다 .
  • 20.
  • 21.
  • 22. 방법은 ? 데이터의 양이 어느 정도인가 ? 알고리즘 효율이 어떠한가 ? 엔진의 이해도가 높은가 ? 시스템 구조에 대한 이해가 높은가 ? 코드 길이가 짧다고 빠르지 않다 ? 4
  • 23. 데이터의 양이 어느 정도인가 ?
  • 24. 100 개의 데이터 1000 개의 데이터 . . .
  • 25. = 0; i < 100; i++) array[i] = i; for(var i = 0; i < 100; i++) sum += array[i]; JavaScript var array = [], sum = 0; for(var i = 0; i < 1000; i++) array[i] = i; for(va ee();})(); ee();})(); JavaScript
  • 26. $ time node SumEx1.jsreal0m0.484suser 0m0.473ssys 0m0.014s$ time node SumEx2.jsreal0m3.310suser 0m3.305ssys 0m0.039s
  • 28. JavaScript JavaScript if(array[i] === value) result = i; return result; } var array = []; for(var i = 0; i < 1000; i++) array 200000; i++) result = indexOf( array, 1 );})(); 200000; i++) result = indexOf( array, 1 );})(); i = 0; i < array.length; i++) if(array[i] === value) return i; } var array = []; for(var i = 0; i < 1000; i array[i] = i; var result = 0; for(var i = 0; i < 200000; i++) result = indexOf( array, 1 );})();})(); array[i] = i; var result = 0; for(var i = 0; i < 200000; i++) result = indexOf( array, 1 );})();})();
  • 29. $ time node indexOf1.js real 0m0.605suser 0m0.593ssys 0m0.013s real 0m0.605suser 0m0.593ssys 0m0.013s $ time node indexOf2.js real 0m0.066suser 0m0.056ssys 0m0.009s real 0m0.066suser 0m0.056ssys 0m0.009s
  • 32. 엔진의 이해도가 높은가 ? 시스템 구조에 대한 이해가 높은가 ?
  • 33. JavaScript JavaScript ction(array) { for(var i = 0; i < 1000; i++) ray[i] + i; } var array = []; for(var i = 0; i < 200000; i++) initArray( array );})(); r(var i = 0; i < 200000; i++) initArray( array );})(); r(var i = 0; i < 200000; i++) initArray( array );})(); (function() { var initArray = function(array) { for(var i = 0; i < 1000; i++) array[ for(var i = 0; i < 1000; i++) array[i] = 0; for(var i = 0; i < 200000; i++) initA for(var i = 0; i < 200000; i++) initArray( array );})(); for(var i = 0; i < 200000; i++) initArray( array );})(); for(var i = 0; i < 200000; i++) initArray( array );})();
  • 34. ime node initValue1.js real 0m3.592suser 0m3.581ssys 0m0.035s$ time node initValue2.js real 0m0.534suser 0m0.524ssys 0m0.0
  • 35. ength; i++) sum = sum + array[i]; } var array = [];for(var i = 0; i < 1000; i++) array[i] = i; JavaScript sum = 0, size = array.length; for(var i = 0; i < size; i++) sum = sum + array[i]; } var array = JavaScript
  • 36. 화면 출력은 , 변수에 어떤 조작보다 항상 느리다 .
  • 37. JavaScript JavaScript ; i < 1000; i++) sum = sum + 1; return sum; } var result = 0; for(var i = 0; i < 200000; i++) resvar sum = 0; for(var i = 0; i < 1000; i++) sum = sum + 1; return sum; } var res
  • 38. ime node display1.js1000real0m0.391suser 0m0.374ssys 0m0.018s $ time node display2.js1000...1000 숫 자 가 20 만 번 ...real 0m4.863sus 0m0.685s real 0m4.863suser 0m4.204ssys 0m0.685s real 0m4.863suser 0m4.204ssys 0m0.685s
  • 40. Breaking the JavaScript Speed Limit with V8 http://www.youtube.com/watch?feature=player_embedded&v=UJPdhx5zTaw#!
  • 41. 1 부터 25000 까지 소수 (Prime Number)
  • 42. 14 초 걸리던 코드 ... CPP vs JavaScript (V8) 0.1 초
  • 43. function Primes() { this.prime_count = 0; this.primes = new Array(25000); this.getPrimeCount = function() { return this.prime_count; }this.getPrime = function(i) { return this.primes[i]; } this.addPrime = function(i) { this.primes[this.prime_count+ +] = i; } this.isPrimeDivisible = function(candidate) { for (var i = 1; i <= this.prime_count; i++) { if((candidate % this.primes[i]) == 0) return true; } return false; }};function main() { p = new Primes(); var c = 1; while(p.getPrimeCount() < 25000) { if (!p.isPrimeDivisible(c)) p.addPrime(c); c++; } console.log(p.getPrime(p.getPrimeCount() - 1));}main(); function Primes() { this.prime_count = 0; this.primes = new Array(25000); this.getPrimeCount = function() { return this.prime_count; } this.getPrime = function(i) { return this.primes[i]; } this.addPrime = function(i) { this.primes[this.prime_count++] = i; } this.isPrimeDivisible = function(candidate) { for (var i = 1; i <= this.prime_count; i++) { var current_prime = this.primes[i]; if (current_prime * current_prime > candidate) return false; if( (candidate % current_prime) == 0) return true; } return false; }};function main() { p = new Primes(); var c = 1; while(p.getPrimeCount() < 25000) { if (!p.isPrimeDivisible(c)) p.addPrime(c); c++; } console.log(p.getPrime(p.getPrimeCount() - 1));}main(); Prime1.js Prime2.js
  • 44. JavaScript 는 느리다 . 데이터 양을 제한 . 효율적인 알고리즘 선택 . 부당한 처리를 피함 . 빠르게 실행될 수 있다 . 결론
  • 46. 2012 년 9 월 11 일 TechCrunch Distrupt 20
  • 47. Mark Zuckerberg “지난 2 년간 가장 큰 실수는 네이티브 앱 대신에 HTML5 에 너무 많이 주력 (Betting) 했다는 것이라 생각한다 ”
  • 48.
  • 50.