SlideShare une entreprise Scribd logo
1  sur  53
bsSelector.js
PAEK, Seung-Hyun
- projectBS core committer
- SHOU Communications
projectBS
projectBS
bsJS
bsJS
var color = bs.Dom('#domID')
.S('border-radius', 5, '@width', 100, 'color', '#fff');
console.log(color) // "#fff“
var color = $('#domID').css({
'borderRadius' : 5,
'WebkitBorderRadius' : 5,
'MozBorderRadius': 5
})
.attr('width', 100)
.css('color');
console.log(color) // "#fff"
'bsJS 에 독자적인
셀렉터를 갖고싶은
데..'
‘승현이 니가 만들
면 되겠네~!!'
bsSelector
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
Selector process
query의 tokenizer
요소 선택
요소 순환
요소 판정
결과 반환
query = 'ul.toc li.tocline2‘;
tokens = ['ul', '.toc', ' ', 'li', ‘.tocline2‘];
if(tokens[i].charAt(0) == '#')
document.getElementById(query);
else if(tokens[i].charAt(0) == '.')
document.getElementByClassName(query);
else
document.getElementsByTagName('*');
‘CSS2 spec 은 기본
아냐?'
‘CSS3 spec 도 하는
김에 하지?'
‘CSS4 spec 도
&^&&^%&%'
일단 완성
Sizzle speed
jsPerf.com
getElementById
getElementsByTagName
getElementsByClassName
getElementsByName
querySelectorAll
ID TAG CLASS NAME
2,096,567 1,876,875 1,841,273 1,575,123
17,090,351 8,920,145 8,285,463 8,031,034
19,384,745 16,661,973 17,559,678 19,073,485
ID TAG CLASS
124,963 126,480 106,504
1,091,549 222,199 210,918
2,020,367 321,119 339,747
상황은 조금 나아
졌지만…
다음은???
JavaScript는
인터프리터 언어
인터프리터?
함수 호출을
최소화
함수 호출을 최소화 한다
함수 호출을 최소화 한다
function Non function
16,830 54,080
49,063 49,436
51,524 52,066
네이티브메서드
안심하지 말자
네이티브메서드라고 안심하지 말자
네이티브메서드라고 안심하지 말자
forEach for()
300 879
658 2,851
142 4,229
네이티브메서드라고 안심하지 말자
네이티브메서드라고 안심하지 말자
Function.bind obj.add()
39,188,564 79,601,156
658 2851
5,125,064 473,773,657
LinkedList
getElementsByTagName
getElementsByClassName
var els = document.getElementByTagName(‘div’);
console.log(els.length);
var newEl = document.createElement(‘div’);
document.body.appendChild(newEl);
console.log(els.length);
반복의 제거
div
P[0] P[1] P[2]
element.childNodes;
children.nodeType == 1;
VS
element.children
이런 사실들과
알고리즘등을
고려하면서 재작성
이런 사실들과
알고리즘등을
고려하면서 재작성
Sizzle Mootools-slick bsSelector
함수개수 : 140 93 13
라인수 : 1,214 2,037 305
용량 : 60,335 37,935 13,485
그 결과
Chrome
IE
감사합니다.
ProjectBS
https://www.facebook.com/groups/bs5js/
github bsJS
http://ligo.kr/i7
github bsSelector
http://ligo.kr/o8

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

bsSelector.js(OctoberSky.js)

Notes de l'éditeur

  1. http://jsperf.com/jsconf-id-class-name-tag
  2. http://jsperf.com/jsconf-id-class-name-tag/2
  3. http://jsperf.com/jsconf-function-vs-non-function
  4. http://jsperf.com/jsconf-array-prototype-foreach
  5. http://jsperf.com/jsconf-native-method-function-prototype-bind