Dela via


PDC10: Unlocking the JavaScript Opportunity with IE9

Presenter: Gaurav Seth, Senior Program Manager, JavaScript runtime team

video

  • In This Session
  • Evolution of Chakra (IE JavaScript Engine)
  • New functionality for Developers
  • JavaScript Evolotion
  • Apps now use 1000’s of lines of JavaScript
  • Functionalaity and complexity like a desktop app
  • JavaScript in IE8
  • Interpreter
  • Designed for many hosts
  • Optimized for
  • fast startup
  • efficient memory utilization
  • JavaScript Subsystems in IE8
  • JavaScript interpreter existed on UI thread
  • Dimensions of Browser Performance
  • 20-30% time in JavaScript
  • 10-20% time in Marshalling
  • Compilation to Native Machine Instructions
  • Wins
  • Performance boost at Execution time
  • Compiled code executes faster – benefits large codebases the most
  • Tradeoffs
  • time to compile causes startup delays
  • optimizing the compiler adds overhead
  • Hybrid – Best of both worlds (24:20)
  • Avoid compromise at Startup Time, by leveraging interpreter
  • Interpret and Compile
  • fully leverage hardware
  • interpret on UI thread – stay responsive
  • Compile on a background thread
  • Hybrid Execution Pipeline
  • when compiling finished with a method, calls have their address changed to point to new compiled method
  • Challenges
  • Restrict memory footprint
  • optimize compilation
  • Don’t compile all code
  • keep a compilation queue
  • specutavely compile some amount of code
  • use heristics to add and prioritize the queue
  • hot paths, # of times a function is interpreted, size
  • Demo (28:06)
  • shows a piece of code run on IE8 and compared to IE9
  • Execution Machinery Performance Wins
  • Faster interpreter
  • Faster property access
  • Speedup from Compiled code
  • Impact of Hybrid Design on Real Web
  • analyzed impact on popular AJAX sites
  • 5-25% improvements across load times
  • more responsive browsing experience
  • Interpreter Enhancements (34:34)
  • New Type System – internal data representation
  • dynamic languages demand an efficient Type System
  • types are created at runtime
  • multiple objects often have same set of properties
  • efficient type system needs
  • type evolution
  • type sharing
  • Type Evolution and Sharing (41:40)
  • type evolution: incremental addition to existing types
  • type sharing: work efficiently with limited space usage
  • Other Type System Changes
  • Faster property access via inline caches
  • property access most widely used operation
  • same key of a key-value pair often accessed multiple times on a call site
  • cache the value for each call site
  • Tagged integer support (31-bit)
  • numbers are used frequently
  • 31-bit precision often sufficient
  • special representation for execution speed-ups
  • fall back to regular number if they grow beyond 31-bit
  • Optimized Parser (44:30)
  • fraction of code downloaded is used
  • Deferred Parsing
  • continue syntax checks
  • defer creation of AST’s
  • saves working set
  • faster load times
  • Enhanced UTF-8 support
  • avoid conversion to UTF-16
  • 300-400kb working set wins
  • 3-4% load time wins in complex apps
  • New Bytecode Generator (48:23)
  • register based byte code generator (instead of stack based generator in IE8)
  • ease of mapping to a machine architecture
  • enables instruction optimizations while compiling
  • Enhancements to JavaScript Libraries
  • optimized for top used built-ins
  • RegEx analysis on Background JIT thread
  • Extensive use of Regular Expressions on web
  • Very few needed at load time
  • SSE2 (Streaming SIMD Extensons 2) support
  • Hardware accelerated Math
  • Compiler utilizes enhanced processor instructions set for math
  • Embracing Web Standards with ECMAScript5 (52:58)
  • Enhanced language specification after 10 years
  • Fixed cases where browsers differed from ES3 specification’
  • object model enhancements
  • Object Reflection features
  • Corrected specification errors and ambiguities
  • Native JSON support
  • Array extras
  • Other miscellaneous built-ins
  • Marshalling – DOM Interactions (1:00:30)
  • Direct integration with IE DOM
  • removed COM communication overhead
  • Faster access to DOM objects and API’s
  • Tremendous performance improvements
  • marshalling time reduced by 80%
  • Enhanced DOM Programmability
  • Implmented Web IDL specification
  • DOM object now feel and behave like native ES5 objects
  • DOM fully discoverable through ES5 reflection features
  • DOM objects take advantage of enhanced Object Model
  • Natures ES5 based programming model for developers
  • Demo
  • IE9: A Modern Browser for the Web
  • delivers performance across all IE9 modes
  • some features only in IE9 Standards Mode
  • ECMAScript5
  • tighter integration and enhanced DOM Programmability