All Projects → GoogleChromeLabs → Samples Module Loading Comparison

GoogleChromeLabs / Samples Module Loading Comparison

Licence: apache-2.0
Some tests for comparing performance between bundling and unbundling JS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Samples Module Loading Comparison

Automate Everything
这是我准备写的第一本书,其实早些时候已经打算开始写书了,只是苦于没有写书经验,无从下手。写书不同于博客,写书需要将知识,经验等系统化地讲述出来,而我现在恰巧缺乏这种表现能力。因此我决定在这里将项目中零散的东西记录下来,然后后期润色一下,写成一本书。
Stars: ✭ 430 (+696.3%)
Mutual labels:  modules, performance
Supreme
Generate UML diagrams of Shiny modules
Stars: ✭ 52 (-3.7%)
Mutual labels:  modules
Autometer
Distributed load testing made simple
Stars: ✭ 42 (-22.22%)
Mutual labels:  performance
Tinystr
A small ASCII-only bounded length string representation.
Stars: ✭ 48 (-11.11%)
Mutual labels:  performance
Nanoscope
An extremely accurate Android method tracing tool.
Stars: ✭ 1,023 (+1794.44%)
Mutual labels:  performance
Postcss Import
PostCSS plugin to inline @import rules content
Stars: ✭ 1,048 (+1840.74%)
Mutual labels:  modules
Enqueue Elastica Bundle
The bundle extends functionality of FOSElasticaBundle. Improves performance of fos:elastica:populate command
Stars: ✭ 40 (-25.93%)
Mutual labels:  performance
Goldiloader
Just the right amount of Rails eager loading
Stars: ✭ 1,074 (+1888.89%)
Mutual labels:  performance
Aws Power Tuner Ui
AWS Lambda Power Tuner UI is an open source project creating a deployable easy to use website built on a layered technology stack allowing you to optimize your Lambda functions for cost and/or performance in a data-driven way via an easy to use UI.
Stars: ✭ 52 (-3.7%)
Mutual labels:  performance
Pomodoro
A simple WordPress translation cache
Stars: ✭ 47 (-12.96%)
Mutual labels:  performance
React Performance
Let's make our apps fast ⚡
Stars: ✭ 1,035 (+1816.67%)
Mutual labels:  performance
Etrace
Emacs Lisp Latency Tracing for the Chromium Catapult Trace Event Format
Stars: ✭ 45 (-16.67%)
Mutual labels:  performance
Sanic.js
JS Gotta go fast ! | Increase native JS functions performances
Stars: ✭ 50 (-7.41%)
Mutual labels:  performance
Import Cost
displays the import size of the package you are importing inside the code editor
Stars: ✭ 1,021 (+1790.74%)
Mutual labels:  performance
Profimp
Python import profiler
Stars: ✭ 52 (-3.7%)
Mutual labels:  performance
Stat
STAT - the Stack Trace Analysis Tool
Stars: ✭ 40 (-25.93%)
Mutual labels:  performance
Performance Improvements For Woocommerce
Performance tweaks for the front-end and back-end of a store.
Stars: ✭ 46 (-14.81%)
Mutual labels:  performance
Optimizing An Angular Application
Code for my ngconf talk "Optimizing an Angular Application".
Stars: ✭ 49 (-9.26%)
Mutual labels:  performance
Pgtune
Pgtune - tuning PostgreSQL config by your hardware
Stars: ✭ 1,078 (+1896.3%)
Mutual labels:  performance
Ansible Role Memcached
Ansible Role - Memcached
Stars: ✭ 54 (+0%)
Mutual labels:  performance

Browser module loading tests

This sample takes moment.js and three.js, and prepares them for loading in the browser with ECMAScript modules.

Development

Cloning this repository

Standard stuff :) Hit the "Clone or download" button in the project's GitHub landing page and go from there.

Installing dependencies

NPM packages need to be installed on the root and both src/ subdirectories.

npm i
cd src/moment
npm i
cd ../..
cd src/three
npm i
cd ../..

Gulp needs to be available globally. You can install it by doing:

npm i -g gulp

Building and developing

gulp build

Running the HTTP server

First add cert.pem and key.pem files for TLS. If you don't have these, you can use simplehttp2server to generate them for you. Place them at the root of the clone.

Then:

go run server/server.go

Or, if you don't have go command, you can use the built in HTTP server instead:

gulp serve

HTTP server command line options:

  • --http1: serve over HTTP/1.1 instead of HTTP/2
  • --push: use HTTP/2 push when serving
  • --preload: inject <link rel="preload"> tags for JS dependencies when serving

E.g., to serve over HTTP/1.1 with preload enabled:

go run server/server.go --http1 --preload

Bundled / unbundled tests

The bundled / unbundled test cases are served at the following URLs:

These tests load the files only once, so the results may be noisy. At the toplevel test page https://localhost:44333/ you can run the unbundled test cases repeatedly (25 times) and see the median time.

Synthesized module tree tests

In addition to the real-world library test cases, this HTTP server provides a benchmark for artificial module tree shapes. This is served at https://localhost:44333/synthesized/ and it accepts the following query parameters:

  • depth (default: 5): height of the module dependency tree
  • branch (default: 2): number of child modules non-leaf modules have
  • delay=n (optional): sleep n milliseconds in response handler
  • cacheable (optional): make JavaScript resources cacheable

E.g., this loads a module whose dependency tree is a perfect binary tree of depth 10 (2047 modules in total): https://localhost:44333/synthesized/?depth=10&branch=2

Note: Currently, --push and --preload options are not supported in synthesized tests.

[Experimental] WebBundle tests

Web Bundle is a file format for encapsulating one or more HTTP resources. It allows distributing a large number of module scripts as a single HTTP resource.

You need WebBundle Go tools to generate Web Bundles, which can be installed by this command:

go get -u github.com/WICG/webpackage/go/bundle/cmd/...

Then, this command will generate Web Bundles for the moment.js / three.js tests:

./gen-bundles.sh

As of April 2020, Web Bundles support is implemented only in Chromium-based browsers, behind an experimental feature flag. To enable Web Bundles in Chrome, turn on chrome://flags/#web-bundles flag.

After enabling the flag, drag and drop samples-module-loading-comparison.wbn into Chrome to open it. An index page will be displayed from which you can choose a benchmark to run.

gen-bundles.sh also generates dist/moment/momentjs.wbn and dist/three/threejs.wbn. They only bundle the module scripts for each test. These can be used with dist/{moment,three}/webbundle.html to test Subresource loading with Web Bundles. (Note: this is a proposal in very early stage; experimental implementation is not landed in any browsers as of April 2020.)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].