ChakraCore - JSConf Last Call

  • Published on
    14-Apr-2017

  • View
    367

  • Download
    0

Transcript

PowerPoint PresentationChakraCoreGaurav Seth@GauravSeth Principal PM Manager Chakra & TypeScript 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.12/7/20151Microsoft & Chakra JavaScriptJavaScript200820153JavaScript - Beyond the BrowserStore based applications, Server applications, Services, IoT4Push the boundaries of interoperable language landscape to enable developers to create great apps Language LandscapeLanguage SupportECMAScript 6aka.ms/ES6CompatChart Pushing InteropActive member of ECMA TC39 committeeEditor for ES2016Editor for test262Leading language implementationChallenging for engineering Data driven spec evolutionSharing breaking change data with the committee/other implementers to evolve ECMAScript90%71%74%65%And beyondAsync Functions, Exponentiation operator etc.12/7/20156 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.ASM.jsPredictable near native performance for the web platformIn partnership with MozillaOptimizable, low-level subset of JavaScriptLeveraged principally by transpiling C/C++ code to run on the Web platformAOT compilation provides predictable performancePotential to provide speed benefits to many more scenarios over a period of timeaka.ms/asmjsChess7SIMD: Single Instruction, Multiple Data (ES2016)In Development in partnership with IntelExploits data level parallelism using hardware capabilitiesAllows same operations to be performed on multiple data points simultaneouslyLarge number of existing processors support SIMD operationsBenefits applications in fields like games, 3D graphics, audio/video processing, multimedia applications etc. Four add operations without SIMDSingle add operation with SIMDaka.ms/JumpingBirds8Next step in our Journey9Chakra is goingOPEN SOURCE10ChakraCore Open Source core of ChakraBrowse the sourcesSubmit pull requestsHelp us find issuesEmbed it in your appsInnovate on top COMING AFTER THE HOLIDAYS1112/7/2015 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.ChakraCore12/7/201512 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.DemosCandy RobotRaspberry Pi 2Windows 10 IoT Core Node.js (with ChakraCore)100+ npm modules including cylon, serialport, firmata & express14Time Travel Debugging Peek into the futureStep backwardsStep to previous callback / promiseMikeal Rogers, Node Foundation16Enable developers to deliver consistently delightful user experiences across all form factors Performance17Customer Feedback: Edge executes YouTube html5player.js script slow on (a few sites)Stack walking improvements for real world sitesStack walk to identify the callerRelying on the OS APIs to do virtual unwindData rich but costly + Not all data from OS APIs neededNow: JITed functions linked via RBP chains; much faster stack walkListening to FeedbackWins: 40-50% better page load times of specific sitesWhat triggers: .caller; .argumerts, this patch up in arrow functionsGo to the callerQuerying was slowJITed frames linked via RBP registers; and we walk the rbp chain; frame pointer chain and walk itTo walk the stack in amd64, we call the OS via RtlLookupFunctionEntry to get the pdata of the current frame and use it to do virtual stack unwind. The query of pdata is costly and we dont really need all the information about the current or caller contexts if all we're doing is walking the stack (stack unwinding will still need all the info). Time spent querying the OS for pdata is specially significant for our jitted frames and has shown up in a number of websites (bug 3247516 and dupes) slowing their performance in Edge.Now, while C++ functions aren't required to save rbp, our jitted functions do. This change enables us to walk the jitted frames from the first jitted frame encountered by just following the Rbp chain. This has shown improvements of upto 35-40% in load times of the websites reported to us.Bug 2320508:pcgamer.com: IE takes executes YouTube html5player.js script significantly slower than Chrome18Always optimizing the engineStartup, throughput, scalability, using the full power of the hardwareSimple JIT TierNew non-optimizing JIT tierIncreases code throughput by faster transition to compiled codeWins: 30% improvement in TypeScript compilers throughputMultiple Concurrent JITsLarge functions block the JIT compilerAbility to spawns multiple JIT threads based on hardware profilesBailout Memory Reduction Cortana runs across a range of device profilesMemory footprint important for optimized user experiencesOptimized JITs maintain bailout info to continue execution when type assumptions go wrongE.g. JS heavy payload in browser - 15MB JIT code to 50MB of bailout info/local offsetsOptimized bailout info and local offsets shared & tightly packedWins: Down from 50MB to 18MB 1/3rd memory reduction Staying lean across a range of scenariosCortanaOptimize BailOutRecord Memory===============================We currently consume a significant amount of memory for BailOutRecord compared to the generated jitted code. As for example, for Octane benchmark we allocated 50MB of BailOutRecord memory compared to 15MB jitted code. Of that 50MB of BailOutRecord Memory, 23MB was allocated for the BailOutRecord class and 27MB was allocated for the localOffsets.This change reduces the memory usage to 18.4MB of which 14MB is spent on the BailOutRecord class and 4.4MB is spenton localOffsets. These is achieved by:- Sharing localOffsets that need to be restored after bailout among all the bailout points of a function. We keep a sorted tableof these entries for each function.- Packing the BailOutRecord class more tightly- Restoring the value from the shared tableRelated Work Items: Bug 2815574: Memory for bailout information is much higher (7.4 MB) compared to size of JIT'd code (1.9 MB) which increases the memory footprint of Cortana20But what about benchmarks?Owned by: GoogleEdge leads closest competitor by 10+%System info: 64-bit browsers on Intel Core i5-34755 @ 2.90Ghz with 4.0GB RAM running Windows 10Owned by: Apple Edge leads closest competitor by 40+%Though I dislike talking about benchmarks when it comes to performance, its hard to not talk about benchmarks, since a lot of people ask about the same. Today, Chakra leads in several industry renowned JavaScript benchmarks like Octane, JetStream and SunSpider. There are two things that are really worth calling out:Its worth calling out that these benchmarks are owned by another browser vendor. The good news is that Chakra Core supports the exact same performance profile. 21Its a Journey: Road aheadChakraCore sources coming post holidaysPR to Node.js mainlineInteroperable debugging supportTime Travel Debugging Cross platform support Committed to OSSEngage, develop and learnCommitted to JavaScript and its evolutionMake JavaScript powerful tools, VMs, libs, compilers and more Thank you!@gauravseth