> For the complete documentation index, see [llms.txt](https://sliu583.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sliu583.gitbook.io/blog/specific-work/seminar-and-talk/reading-groups/network-reading-group/ml-and-networking/other/horcrux-automatic-javascript-parallelism-for-resource-efficient-web-computation.md).

# Horcrux: Automatic JavaScript Parallelism for Resource-Efficient Web Computation

* Modern web browsing&#x20;
  * Performance matters
    * User: 53% of visits are abandoned if a mobile site takes longer than 3s to load&#x20;
    * Content Providers: if your site makes $100,000/day, 1s improvement in page load increases revenue by $7,000 daily&#x20;
* The problem: computation delays&#x20;
  * Evaluation setup:&#x20;
    * Performance metrics: Page Load Time (PLT), Speed Index (SI)&#x20;
  * Developed Region, Emerging Region&#x20;
* Why are computation delays significant&#x20;
  * 80% more JavaScript over the last 5 years&#x20;
  * Mobile Devices
    * **More cores != better performance**&#x20;
    * Reason: Single-thread execution --> solution: parallelizing JavaScript&#x20;
    * Main idea: **automatically parallelizes JavaScript execution using concolic execution to take advantage of phones multi-core CPUs**&#x20;
* &#x20;Parallelism Opportunities&#x20;
  * Web workers are widely supported by browsers&#x20;
  * Constrained APIs:
    * No access to DOM APIs&#x20;
    * No access to the main global state&#x20;
  * Legacy pages are highly amenable to safe parallelism&#x20;
* Challenges&#x20;
  * C1: ensuring correctness&#x20;
    * The exact state accessed by parallelized JavaScript --> conservative signatures&#x20;
      * Despite non-determinism and across all possible control paths&#x20;
    * Conservative signatures&#x20;
      * Dynamic analysis: track read / writes to page state&#x20;
      * Concolic execution: explore all possible control paths&#x20;
      * ![](/files/qu8gS4XUgNSCPdhoMuSo)
      * Server-side and offline&#x20;
  * C2: web workers constrained APIs
    * How to parallelize execution with constrained APIs?&#x20;
      * Client-side parallelization scheduler&#x20;
        * Runs in the main browser thread
        * Only task: manage offloads in event-driven mode&#x20;
  * C3: Offloading overheads&#x20;
    * Pass-by-value I/O can take \~0-10ms&#x20;
      * Root-function Granularity&#x20;
      * Offloading Granularity&#x20;
        * Trade-off: parallelization benefits vs. offloading overheads&#x20;
        * Solution: offloading root-function invocations&#x20;
        * 4x fewer offloads and 73% of parallelization benefits&#x20;
* Evaluation&#x20;
  * Impact on browser computation delays?&#x20;
    * Total computation time (TCT)
  * Impact on end-to-end performance?
    * Page Load Time (PLT), Speed Index (SI)&#x20;
  * Horcrux comparison to prior compute optimizations?
  * What do conservative signatures forgo?
  * How much are the server-side overheads?&#x20;
