Git Product home page Git Product logo

workopter's Introduction

workopter

Optimization experiments for Web Workers

Experiments

Loading Dependencies

In order to reduce bandwidth usage and speed up page load we can request a bundle of dependencies packaged as a JSON object where each entry in the object contains the name (key) and string of code (value). The code string can be passed to web workers via postMessage and then eval-ed to load that dependency.

  • importScripts
  • eval(string) with the main thread send the string to the worker

Code -> AST

There are lots of live-editor features that require an AST.
Parsing the code once and then sharing the AST will reduce CPU usage. There's some overhead from converting to/from a JSON string as well as sending these strings via postMessage. It may be possible to reduce that overhead by using SharedWorkers and or Transferable Objects.

  • always parse (base case)
  • parse once in a web worker and transport using JSON strings
  • parse once in a web worker and transport using an ArrayBuffer (containing a JSON string)
  • parse once in a shared worker and transport using the faster method

Future Work

Right now order of depdencies loaded in this fashion are the responsibility of the developer. It would be nice to be able to a module and all of it's dependencies and package them into a single bundle from which multiple modules (and their dependencies) could be extracted and loaded in the correct order.

workopter's People

Contributors

kevinbarabash avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.