geelen / jspm-server

A live-reloading development server for JSPM
144 stars 12 forks source link

Experimental fork #41

Open douglasduteil opened 8 years ago

douglasduteil commented 8 years ago

I'm doing my own experimentation in a fork The goal is to provide an server capable of

I publish my result on npm so we can test stuff. douglasduteil...jspm-server

douglasduteil commented 8 years ago

douglasduteil...jspm-server experiments results

Here comes the raw results

HTTP 1

douglasduteil jspm-server-demo-http1

http1-timeline

HTTP 2

'use strict'

module.exports = {
  root: __dirname,
  ssl: true
}

douglasduteil jspm-server-demo-http2

http2-timeline

HTTP 2 and a generated Systemjs#depCache

'use strict'

module.exports = {
  root: __dirname,
  ssl: true,
  transformer: {
    files: {
      pattern: [
        'src/*.js'
      ]
    }
  },
  system: {
    configFile: './config.js',
    depCache: ['css', 'babel', 'src/main.js']
  }
}

douglasduteil jspm-server-demo-http2-depcache

http2-depcache-timeline

HTTP 2 and a generated Systemjs#bundles

'use strict'

module.exports = {
  root: __dirname,
  ssl: true,
  system: {
    configFile: './config.js',
    depCache: [],
    bundles: [
      'css + src/main - [src/**/*] - [src/**/*.css!]',
    ]
  }
}

douglasduteil jspm-server-demo-http2-bundle

http2-bunlde-timeline

douglasduteil commented 8 years ago

Following https://github.com/jspm/jspm-cli/issues/872 #4 #29

guybedford commented 8 years ago

This is very enlightening. The lack of a speed up here seems like it may be due to:

It seems like there is the potential here for a big performance boost if the server was aware of the dependency tree priorities and optimized the HTTP/2 transport itself to ensure critical resources are transferred first. For example, simply raising the priority of babel here would likely reduce time significantly.

douglasduteil commented 8 years ago

Hi there @guybedford it's been a while now. Sorry... I'm back now.

Did something change on this subject ? I would like to tackle it but I can't find how. You were saying (5 month ago) that

It seems like there is the potential here for a big performance boost if the server was aware of the dependency tree priorities and optimized the HTTP/2 transport itself to ensure critical resources are transferred first.

  • Can systemjs-builder#trace functions be use to extract the priority of a dependency (through the depth of this dependency) ?
  • Is it systemjs in depcache mode that from the client sends the requests with priorities inside the header ?

Looking forward to work with you again :) Douglas.

guybedford commented 8 years ago

@douglasduteil nice to hear you're interested in some experimenting here. Yes SystemJS builder trace contains everything that is needed to know about the tree to handle prioritisation as it provides the graph. Reading that graph can be seen in for example https://github.com/systemjs/builder/blob/master/lib/compile.js#L148.

SystemJS depcache effectively does equal prioritisation, but because all loads are on the critical path it's mostly ok. Where a prioritised depCache would help is for plugin loads, see https://github.com/systemjs/systemjs/issues/263.

Another big thing for speedup is server-side precompilation of the SystemJS translate hook. I've been working on a test for this in https://github.com/guybedford/karma-systemjs-experiment which you may find interesting as well.