1 of 41

Platform Architecture Team Roadmap for 2017

*

*

2 of 41

Team goals

  • Build up the core architecture of the web platform that improves performance, memory and code health that empowers other teams to work on new features

  • Lead architectural changes and discussions that affect a broad area of the code base

*

*

3 of 41

Focus areas

  • Memory
  • Bindings
  • Onion Soup
  • Scheduling
  • Frames

*

*

4 of 41

Memory

5 of 41

Team structure (We are TRIM)

*

*

6 of 41

Achievements in Q2/Q3

  • Improved memory-infra + Investigated real-world websites
    • Shifted our scope from Blink to the entire Chrome
  • Reduced a lot of memory!
    • 15 MB reduction on Tumblr
      • Removed duplicated encoded images
    • 6 MB reduction on Facebook
      • Fixed a color format of decoded images
    • ...and many other reductions
  • Shipped Oilpan's per-thread heaps
    • Isolated GC performance per thread

*

*

7 of 41

Roadmap for 2017

*

*

8 of 41

Roadmap for 2017

  • Reduce more memory from all over Chrome
  • Identify sweet spots
  • encoded images, JavaScript source strings, socket buffers in net/, storage in sync/, ...
  • Work with relevant teams and reduce memory
      • V8 team, loading team, network team, GPU team, ...

*

*

9 of 41

Roadmap for 2017

  • Ship purge+suspend
    • Purge as much memory as possible and immediately suspend background renderers
      • However, resume the suspended renderers every 2 mins to mitigate compatibility concerns
      • In long term, the suspension mechanism should be replaced with the timer-based throttling of Blink Scheduler
    • Impact: 71% reduction on Facebook, 62% on Tumblr, 20 - 40% on average websites

*

*

10 of 41

Roadmap for 2017

  • Ship Memory Coordinator
    • A centralized memory scheduler for all memory components in Chrome

*

*

11 of 41

Roadmap for 2017

  • Ship Memory Coordinator
    • Schedule background tabs with the following priority:
  • Throttle memory of background tabs
  • Purge and suspend background tabs
  • Kill background tabs

*

*

12 of 41

Summary

  • Visualize all Chrome-wide object allocations in memory-infra
  • Reduce more memory from all over Chrome
  • Ship purge + suspend
  • Ship Memory Coordinator

*

*

13 of 41

Bindings

14 of 41

Team structure

*

*

15 of 41

Achievements in Q2/Q3

  • Helped other teams ship new features
    • CustomElement, IntersectionObserver, OriginTrials, Worklet etc
    • Supported new WebIDL features
      • IDL union types, frozen arrays, [SameObject] etc
  • Speeded up an iframe creation by 75%
  • Speeded up postMessage by 3x (faster than Firefox!)
  • Fixed a bunch of (not shiny but) important interop issues
    • Window's prototype chains, indexed properties etc

*

*

16 of 41

Roadmap for 2017

  • Keep helping other teams ship new features
    • Upon your request :D
    • Will ES6 modules & HTML modules be a big customer?

*

*

17 of 41

Roadmap for 2017

  • Make V8 bindings as fast as JSC and Firefox
    • Implement V8 context snapshotting
      • Create a snapshot of a V8 context at compile time
      • This will make an iframe creation 2x faster

*

*

18 of 41

Roadmap for 2017

  • Make V8 bindings as fast as JSC and Firefox
    • Reduce overhead of content script injection
      • UMAs indicate that there are lots of cases where content script injection causes 100+ ms of janks when the main thread creates an iframe

*

*

19 of 41

Roadmap for 2017

  • Make V8 bindings as fast as JSC and Firefox
    • Reduce overhead of hot binding operations
      • Let V8 access DOM attributes without leaving JIT
      • Make a wrapper creation faster

*

*

20 of 41

Roadmap for 2017

  • Make V8 bindings as spec-compliant as JSC and Firefox
    • Guarantee that all scripts run on a correct browsing context
    • Make script execution on detached frames not crash
    • Correctly handle cross-origin accesses to window/location objects

*

*

21 of 41

Roadmap for 2017

  • Make V8 ⇔ Blink reference cycles traceable
    • Provide a simpler memory model
      • You just need to write traceWrapper()
    • Make V8 wrappers' lifetime more correct and non-leaky

*

*

22 of 41

Summary

  • Keep helping other teams ship new features
  • Make V8 bindings as fast as JSC and Firefox
  • Make V8 bindings as spec-compliant as JSC and Firefox
  • Make V8 ⇔ Blink reference cycles traceable

*

*

23 of 41

Onion Soup

24 of 41

Team structure

*

*

25 of 41

Accomplishments in Q2/Q3

  • Massively simplified layering and reduced technical debts:
    • Removed 10000+ lines of code
    • Removed many abstraction classes
  • Removed OwnPtr<>
  • Made WTF::bind a thin wrapper of base::Bind
  • Enabled to move Blink Scheduler to platform/ and improve Speedometer by 7%!
  • Mojofied 16 web-platform features

*

*

26 of 41

Before Onion Soup

*

*

27 of 41

After Onion Soup

*

*

28 of 41

Roadmap for 2017

  • Blink Mojofication:
    • Move all web-platform features from content/ to Blink using Mojo
      • Blink can directly talk to the browser process
      • The old IPC should be gone

*

*

29 of 41

Roadmap for 2017

  • platform/ componentization:
    • Componentize platform/ into well-modularized units
    • Make the team-code ownership explicit
    • Merge wtf/ into platform/

*

*

30 of 41

Roadmap for 2017

  • web-modules:
    • Enable developers to implement high-level web features on top of web-exposed APIs in C++
    • Eventually replace Blink-in-JS and web/ with web-modules

*

*

31 of 41

Summary

  • Onion Soup
    • Blink Mojofication
    • platform/ componentization
    • web-modules

*

*

32 of 41

Scheduling

33 of 41

Team structure

*

*

34 of 41

Accomplishments in Q2/Q3

  • Implemented a per-frame scheduler
    • Goal: Isolate performance of third-party contents from main contents
    • Enabled Blink Scheduler to throttle more tasks on offscreen iframes and background tabs
  • Improved Speedometer by 7% by making task cancellation faster!

*

*

35 of 41

Roadmap for 2017

  • Move almost all tasks to the per-frame scheduler
    • Give more power to Blink Scheduler to throttle tasks on offscreen iframes and background tabs
    • Make the task ordering more spec-conformant

*

*

36 of 41

Roadmap for 2017

  • Identify what the arch team can do for saving power (TBD)
    • Inside Blink Scheduler (scheduler team):
      • More aggressive task throttling
    • Outside Blink Scheduler (arch team):
      • Introduce PowerCoordinator and make the clients post less tasks

*

*

37 of 41

Roadmap for 2017

  • Design and implement Global Tab Coordinator (TBD)
    • A centralized tab-level coordinator that makes smarter scheduling decisions in the trade-off space between performance, memory and power

*

*

38 of 41

Roadmap for 2017

  • Design and implement Global Tab Coordinator (TBD)
    • Unify various coordinating units (MemoryCoordinator, PowerCoordinator, Blink Scheduler etc)
    • Consistently introduce a concept of "mode"s to the code base:
      • performance mode
      • memory-saving mode
      • power-saving mode
      • data-saving mode

*

*

39 of 41

Summary

  • Move almost all tasks to the per-frame scheduler
  • Identify what the arch team can do for saving power (TBD)
  • Design and implement Global Tab Coordinator (TBD)

*

*

40 of 41

Summary

41 of 41

2017 roadmap of arch team

  • Memory:
    • Significant memory reductions in browser and renderer
  • Bindings:
    • Making V8 bindings as fast and spec-compliant as JSC and Firefox
  • Onion Soup:
    • Massively reduce technical debts of Blink's architecture
  • Scheduling:
    • Global Tab Coordinator (Makes smart scheduling decisions between performance, memory and battery)

*

*