Munter / express-systemjs-translate

Express middleware to speed up systemjs development loads by running translations serverside
28 stars 4 forks source link

Speed regression from 2.0.0 to 4.0.0 #181

Closed gustavnikolaj closed 8 years ago

gustavnikolaj commented 8 years ago

I got around to updating our proof of concept from early Juli now that I'm back from vacation.

It still works fine modulo some problems with CSS that relies on the order of loading (which is hardly a related problem) :-)

There is one problem though - the initial built time went from ~3 seconds to 10 seconds and the rebuild times went from ~900 ms to ~3 seconds. The reload times are with no changes to the files at all.

I'm using the latest systemjs-builder (v0.15.25) which includes the fix that @guybedford mentioned in #174

Is that slowdown just to be expected from adding Source Maps? I'll try to dig deeper.

gustavnikolaj commented 8 years ago

Most time is spent inside systemjs-builder.

Debug output:

Initial request:

express-systemjs-translate: DEBUG 5.308 systemjs-builder
express-systemjs-translate: DEBUG 0.073 watch requested files
express-systemjs-translate: DEBUG 0.000 store depCache information
express-systemjs-translate: DEBUG settings/settings.js source map inlined
express-systemjs-translate: DEBUG 0.012 upgrade source maps
express-systemjs-translate: DEBUG 0.017 serve

Next:

express-systemjs-translate: DEBUG 1.847 systemjs-builder
express-systemjs-translate: DEBUG 0.071 watch requested files
express-systemjs-translate: DEBUG 0.000 store depCache information
express-systemjs-translate: DEBUG settings/settings.js source map inlined
express-systemjs-translate: DEBUG 0.011 upgrade source maps
express-systemjs-translate: DEBUG 0.018 serve

Running with the following options:

{
    configFile: path.resolve(publicDir, 'config.js'),
    baseUrl: publicDir,
    debug: true,
    normalize: true
}

Note: These numbers are taken from a different application. I chose to dive in with a smaller application.

gustavnikolaj commented 8 years ago

Timings of the same application with source maps turned off:

Initial:

express-systemjs-translate: DEBUG 3.579 systemjs-builder
express-systemjs-translate: DEBUG 0.073 watch requested files
express-systemjs-translate: DEBUG 0.000 store depCache information
express-systemjs-translate: DEBUG 0.000 upgrade source maps
express-systemjs-translate: DEBUG 0.008 serve

Next:

express-systemjs-translate: DEBUG 0.528 systemjs-builder
express-systemjs-translate: DEBUG 0.068 watch requested files
express-systemjs-translate: DEBUG 0.000 store depCache information
express-systemjs-translate: DEBUG 0.000 upgrade source maps
express-systemjs-translate: DEBUG 0.006 serve
gustavnikolaj commented 8 years ago

Looks like it's just the overhead of the source maps. Turning on lowResSourceMaps is a good way of gaining some speed back:

Initial:

express-systemjs-translate: DEBUG 3.041 systemjs-builder
express-systemjs-translate: DEBUG 0.105 watch requested files
express-systemjs-translate: DEBUG 0.001 store depCache information
express-systemjs-translate: DEBUG settings/settings.js source map inlined
express-systemjs-translate: DEBUG 0.002 upgrade source maps
express-systemjs-translate: DEBUG 0.009 serve

Next:

express-systemjs-translate: DEBUG 1.064 systemjs-builder
express-systemjs-translate: DEBUG 0.104 watch requested files
express-systemjs-translate: DEBUG 0.000 store depCache information
express-systemjs-translate: DEBUG settings/settings.js source map inlined
express-systemjs-translate: DEBUG 0.002 upgrade source maps
express-systemjs-translate: DEBUG 0.009 serve

Especially if you don't use transpilation at all :-)

https://github.com/systemjs/builder#minification--source-maps