SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
PPT模板下载:www.1ppt.com/moban/

Performance on JS
Briefing

What's this topic about
杨琦 UCWEB 浏览器研发部
Topics
Scope:
– Single-page application
– Ajax and Web 2.0
– Download and execute more code as you interact

Topics:
– Variable Scope Management
– Data accessing
– Loops & Functions
– ASMJS
Variable Scope Management

Scope Chain Matters?
Scope Chain ?
How to find out a variable ?
– Variable inside javascript: Data Reference.
– How to locate a variable in functions: From Local to Global
– What does the VM do before execution a function?
嗗 Create a stackframe before getting into functions
嗗 Reference all the outer function variables by pointers to array in stackframe
嗗 Referencing local variables in stackframe
嗗 Push stackframe into vm's execution context
嗗 All the stackframes => Scope Chain

– What does the VM do during execution ?
Scope Chain ?
Matters ?
It really matters?
– Testing cases:
嗗 scope chain lookups
嗗 Scope Chain
嗗 Simple Test

– ResuIt: It does NOT matter !

Special cases
– try/catch
– try/catch with fail
Scope Chain ?
Why ?
– Just in time compiler!
嗗 All the variables is looked up inside the scope chain as less times as possible.
嗗 Once referenced, cached it!
嗗 Check the type & avaibilities on the fly with minus cost (usually assembly code)

– The state of art javascript vm supporting jit!

What matters ?
– Calling slower routings (exception blow up)
– Variable type changed during executions (delete a.b)
Data accessing

Data accessing Matters?
Ways of data accessing
Data variables for accessing
– Literal value
– Variable
– Object property
– Array item
The old report
Data variables for accessing
– Literal value
– Variable
– Object property
– Array item
The latest report
Data variables for accessing
– Variable vs Object property
嗗 Nearly the same. Thanks to hidden class and jit.
嗗 A hidden class is some hint that provide the jit how to access the property data inside
a object.

– Array item vs Object property
嗗 Object is faster than array in dealing with sparse data.
Loop & Functions

What Matters?
Loops
for (a in b) / forEach
– Loops tests
– for (A in B )?
嗗 Same:
– Pickout A from B each loop
– Create reference on the fly

嗗 Diff:
– foreach use iterator & generator
– for-in track whether this property is enumable.

– Using normal while/for loop will be better.

For / While
– For vs While
– It is nearly the same
Functions
Arguments/ Prameters
– args vs params
– Please using parameters.

Function Costs
– Function cost
嗗 Creating stackframes.
嗗 Maintaining local variables.
嗗 GC.

– Try to inline something
ASMJS

Not ready!
ASMJS
ASMJS ?
– an extraordinarily optimizable, low-level subset of JavaScript

Performance Boost?
– fib normal vs asm
嗗 Using asmjs slower! (Due to compilation overhead)
嗗 DFG etc is enough to find out the data types.

– asm vs no-asm

Conclusion
– Better NOT use it now!
Rock & Roll
Write simple code !
Do not use asmjs now!
Use more hint to ignite the v8/squirrelfish !
Q&A
THANKS FOR YOUR LISTENING

Más contenido relacionado

La actualidad más candente

The Future starts with a Promise
The Future starts with a PromiseThe Future starts with a Promise
The Future starts with a PromiseAlexandru Nedelcu
 
Lyonrb 12feb2014-sidekiq
Lyonrb 12feb2014-sidekiqLyonrb 12feb2014-sidekiq
Lyonrb 12feb2014-sidekiqKurt Sussman
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingĐặng Thái Sơn
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Jalpesh Vadgama
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5Gal Marder
 
Reactive Extensions for JavaScript
Reactive Extensions for JavaScriptReactive Extensions for JavaScript
Reactive Extensions for JavaScriptJim Wooley
 
Powering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and PythonPowering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and PythonTatiana Al-Chueyr
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaNexThoughts Technologies
 
Introducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using itIntroducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using itBruno Faria
 
Apollo server II
Apollo server IIApollo server II
Apollo server IINodeXperts
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with RxjavaChristophe Marchal
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow IntroductionLiangjun Jiang
 
OASGraph LoopBack 4 Integration
OASGraph LoopBack 4 IntegrationOASGraph LoopBack 4 Integration
OASGraph LoopBack 4 IntegrationMario Estrada
 
New in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web FrameworkNew in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web FrameworkVMware Tanzu
 

La actualidad más candente (20)

The Future starts with a Promise
The Future starts with a PromiseThe Future starts with a Promise
The Future starts with a Promise
 
Lyonrb 12feb2014-sidekiq
Lyonrb 12feb2014-sidekiqLyonrb 12feb2014-sidekiq
Lyonrb 12feb2014-sidekiq
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive Programming
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular
 
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
Javantura v4 - Java and lambdas and streams - are they better than for loops ...Javantura v4 - Java and lambdas and streams - are they better than for loops ...
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
 
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
 
Intro to RxJS
Intro to RxJSIntro to RxJS
Intro to RxJS
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5
 
Variables in Pharo5
Variables in Pharo5Variables in Pharo5
Variables in Pharo5
 
rx-java-presentation
rx-java-presentationrx-java-presentation
rx-java-presentation
 
Reactive Extensions for JavaScript
Reactive Extensions for JavaScriptReactive Extensions for JavaScript
Reactive Extensions for JavaScript
 
Powering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and PythonPowering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and Python
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
 
Introducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using itIntroducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using it
 
Apollo server II
Apollo server IIApollo server II
Apollo server II
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow Introduction
 
OASGraph LoopBack 4 Integration
OASGraph LoopBack 4 IntegrationOASGraph LoopBack 4 Integration
OASGraph LoopBack 4 Integration
 
New in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web FrameworkNew in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web Framework
 

Destacado

Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...
 Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e... Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...
Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...INACAP
 
Dell PowerEdge Porfolio 2013
Dell PowerEdge Porfolio 2013Dell PowerEdge Porfolio 2013
Dell PowerEdge Porfolio 2013Anh Tuan
 
Mapa planificación.
Mapa planificación.Mapa planificación.
Mapa planificación.Dayana Mendez
 
Reaching 100s of milllions at WWF
Reaching 100s of milllions at WWFReaching 100s of milllions at WWF
Reaching 100s of milllions at WWFDave Drodge
 
гуп презентация нефт. промышленность
гуп презентация нефт. промышленностьгуп презентация нефт. промышленность
гуп презентация нефт. промышленностьgcmoo
 
El rubi lectura y escritura
El rubi   lectura y escrituraEl rubi   lectura y escritura
El rubi lectura y escrituraZafiro Jazmin
 
Technology & Social Interaction
Technology & Social InteractionTechnology & Social Interaction
Technology & Social InteractionQuadBee Aderonke
 
Mapa de los recursos audiovisuales
Mapa de los recursos audiovisualesMapa de los recursos audiovisuales
Mapa de los recursos audiovisualesDayana Mendez
 
7. Mensaje de Emanuel Swedenborg
7. Mensaje de Emanuel Swedenborg7. Mensaje de Emanuel Swedenborg
7. Mensaje de Emanuel SwedenborgMercedes Gonzalez
 
Egipat
Egipat Egipat
Egipat adnaa1
 
Birthday celebrators for the month of October- Tondo High School Teachers Tea...
Birthday celebrators for the month of October- Tondo High School Teachers Tea...Birthday celebrators for the month of October- Tondo High School Teachers Tea...
Birthday celebrators for the month of October- Tondo High School Teachers Tea...Olhen Rence Duque
 
Actividades de tercero y cuarto primaria
Actividades de tercero y cuarto primariaActividades de tercero y cuarto primaria
Actividades de tercero y cuarto primariaYoselin Hernández P
 
Chemical & hygiene systems pdf document aqua middle east fzc
Chemical & hygiene systems pdf document aqua middle east fzcChemical & hygiene systems pdf document aqua middle east fzc
Chemical & hygiene systems pdf document aqua middle east fzcAdolfsmith69
 

Destacado (17)

375
375375
375
 
Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...
 Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e... Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...
Sr. Jorge Mujíca, Director de Tecnologías (CTO) de IBM Chile, "IBM Watson: e...
 
Dell PowerEdge Porfolio 2013
Dell PowerEdge Porfolio 2013Dell PowerEdge Porfolio 2013
Dell PowerEdge Porfolio 2013
 
Mapa planificación.
Mapa planificación.Mapa planificación.
Mapa planificación.
 
Bomba de veneno(3)
Bomba de veneno(3)Bomba de veneno(3)
Bomba de veneno(3)
 
Reaching 100s of milllions at WWF
Reaching 100s of milllions at WWFReaching 100s of milllions at WWF
Reaching 100s of milllions at WWF
 
Incoterm
IncotermIncoterm
Incoterm
 
гуп презентация нефт. промышленность
гуп презентация нефт. промышленностьгуп презентация нефт. промышленность
гуп презентация нефт. промышленность
 
Hader bustos vacation
Hader bustos vacationHader bustos vacation
Hader bustos vacation
 
El rubi lectura y escritura
El rubi   lectura y escrituraEl rubi   lectura y escritura
El rubi lectura y escritura
 
Technology & Social Interaction
Technology & Social InteractionTechnology & Social Interaction
Technology & Social Interaction
 
Mapa de los recursos audiovisuales
Mapa de los recursos audiovisualesMapa de los recursos audiovisuales
Mapa de los recursos audiovisuales
 
7. Mensaje de Emanuel Swedenborg
7. Mensaje de Emanuel Swedenborg7. Mensaje de Emanuel Swedenborg
7. Mensaje de Emanuel Swedenborg
 
Egipat
Egipat Egipat
Egipat
 
Birthday celebrators for the month of October- Tondo High School Teachers Tea...
Birthday celebrators for the month of October- Tondo High School Teachers Tea...Birthday celebrators for the month of October- Tondo High School Teachers Tea...
Birthday celebrators for the month of October- Tondo High School Teachers Tea...
 
Actividades de tercero y cuarto primaria
Actividades de tercero y cuarto primariaActividades de tercero y cuarto primaria
Actividades de tercero y cuarto primaria
 
Chemical & hygiene systems pdf document aqua middle east fzc
Chemical & hygiene systems pdf document aqua middle east fzcChemical & hygiene systems pdf document aqua middle east fzc
Chemical & hygiene systems pdf document aqua middle east fzc
 

Similar a 面向引擎——编写高效率JS

Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...Flink Forward
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Christian Catalan
 
2015 01-17 Lambda Architecture with Apache Spark, NextML Conference
2015 01-17 Lambda Architecture with Apache Spark, NextML Conference2015 01-17 Lambda Architecture with Apache Spark, NextML Conference
2015 01-17 Lambda Architecture with Apache Spark, NextML ConferenceDB Tsai
 
Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)camunda services GmbH
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and FallaciesRoman Elizarov
 
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-landKresten Krab Thorup
 
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache Beam
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache BeamMalo Denielou - No shard left behind: Dynamic work rebalancing in Apache Beam
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache BeamFlink Forward
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Pig on Tez - Low Latency ETL with Big Data
Pig on Tez - Low Latency ETL with Big DataPig on Tez - Low Latency ETL with Big Data
Pig on Tez - Low Latency ETL with Big DataDataWorks Summit
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfSreeVani74
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011bobmcwhirter
 

Similar a 面向引擎——编写高效率JS (20)

Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...Flink Forward SF 2017: Malo Deniélou -  No shard left behind: Dynamic work re...
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
 
Vue.js basics
Vue.js basicsVue.js basics
Vue.js basics
 
Scale up your thinking
Scale up your thinkingScale up your thinking
Scale up your thinking
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
 
2015 01-17 Lambda Architecture with Apache Spark, NextML Conference
2015 01-17 Lambda Architecture with Apache Spark, NextML Conference2015 01-17 Lambda Architecture with Apache Spark, NextML Conference
2015 01-17 Lambda Architecture with Apache Spark, NextML Conference
 
Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
 
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-land
 
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache Beam
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache BeamMalo Denielou - No shard left behind: Dynamic work rebalancing in Apache Beam
Malo Denielou - No shard left behind: Dynamic work rebalancing in Apache Beam
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
Java scriptforjavadev part2a
Java scriptforjavadev part2aJava scriptforjavadev part2a
Java scriptforjavadev part2a
 
Nodejs from zero to hero
Nodejs from zero to heroNodejs from zero to hero
Nodejs from zero to hero
 
Pig on Tez - Low Latency ETL with Big Data
Pig on Tez - Low Latency ETL with Big DataPig on Tez - Low Latency ETL with Big Data
Pig on Tez - Low Latency ETL with Big Data
 
G pars
G parsG pars
G pars
 
AJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdfAJS UNIT-1 2021-converted.pdf
AJS UNIT-1 2021-converted.pdf
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

面向引擎——编写高效率JS

  • 2. Briefing What's this topic about 杨琦 UCWEB 浏览器研发部
  • 3. Topics Scope: – Single-page application – Ajax and Web 2.0 – Download and execute more code as you interact Topics: – Variable Scope Management – Data accessing – Loops & Functions – ASMJS
  • 5. Scope Chain ? How to find out a variable ? – Variable inside javascript: Data Reference. – How to locate a variable in functions: From Local to Global – What does the VM do before execution a function? 嗗 Create a stackframe before getting into functions 嗗 Reference all the outer function variables by pointers to array in stackframe 嗗 Referencing local variables in stackframe 嗗 Push stackframe into vm's execution context 嗗 All the stackframes => Scope Chain – What does the VM do during execution ?
  • 7. Matters ? It really matters? – Testing cases: 嗗 scope chain lookups 嗗 Scope Chain 嗗 Simple Test – ResuIt: It does NOT matter ! Special cases – try/catch – try/catch with fail
  • 8. Scope Chain ? Why ? – Just in time compiler! 嗗 All the variables is looked up inside the scope chain as less times as possible. 嗗 Once referenced, cached it! 嗗 Check the type & avaibilities on the fly with minus cost (usually assembly code) – The state of art javascript vm supporting jit! What matters ? – Calling slower routings (exception blow up) – Variable type changed during executions (delete a.b)
  • 10. Ways of data accessing Data variables for accessing – Literal value – Variable – Object property – Array item
  • 11. The old report Data variables for accessing – Literal value – Variable – Object property – Array item
  • 12. The latest report Data variables for accessing – Variable vs Object property 嗗 Nearly the same. Thanks to hidden class and jit. 嗗 A hidden class is some hint that provide the jit how to access the property data inside a object. – Array item vs Object property 嗗 Object is faster than array in dealing with sparse data.
  • 14. Loops for (a in b) / forEach – Loops tests – for (A in B )? 嗗 Same: – Pickout A from B each loop – Create reference on the fly 嗗 Diff: – foreach use iterator & generator – for-in track whether this property is enumable. – Using normal while/for loop will be better. For / While – For vs While – It is nearly the same
  • 15. Functions Arguments/ Prameters – args vs params – Please using parameters. Function Costs – Function cost 嗗 Creating stackframes. 嗗 Maintaining local variables. 嗗 GC. – Try to inline something
  • 17. ASMJS ASMJS ? – an extraordinarily optimizable, low-level subset of JavaScript Performance Boost? – fib normal vs asm 嗗 Using asmjs slower! (Due to compilation overhead) 嗗 DFG etc is enough to find out the data types. – asm vs no-asm Conclusion – Better NOT use it now!
  • 18. Rock & Roll Write simple code ! Do not use asmjs now! Use more hint to ignite the v8/squirrelfish !
  • 19. Q&A
  • 20. THANKS FOR YOUR LISTENING