Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Performance enhancements #196

Merged
merged 127 commits into from
Aug 31, 2017
Merged

🚀 Performance enhancements #196

merged 127 commits into from
Aug 31, 2017

Conversation

abovedave
Copy link
Contributor

@abovedave abovedave commented Aug 8, 2017

This contains most of the improvements from the on hold #167.

Closes #174.
Closes #175.
Closes #158.
Closes #168.
Closes #173.
Closes #51.
Closes #212.

Features

  • Rolled our own internal middleware (see /lib/view/public.js) for serving from the public folder - removed need for Express modules serve-static and serve-favicon.
  • Changed & deprecated config.headers.useGzipCompression to config.headers.useCompression
  • Added an internal helper called help.canCompress which determines if caching is enabled on the system and tests if the client can accept a compressed output
  • Implement more efficient compression engine (brotli, by way of iltorb, fallbacks to Node's zlib for gzip if not available)
  • For clarify, moved the helpers previously name sendBackJSON, sendBackHTML into view/send.js
  • Removed the unused helper sendBackJSONP
  • Added new compression engine to the response, removing need for Express's Compress middleware
  • Static assets obey compression settings via config.headers.useCompression
  • Compressed responses are now cached, rather than being cached on each request
  • Assets that have been compressed are cached, rather than being compressed on each request
  • Public folder assets are only compressed if it will save space (checked using compressible)
  • Removed outdated media path.
  • Enable page caching by default if caching is specified in the config.
  • Refactor of cache flush under api/flush. Added corresponding error page when method is not POST.
  • Fix sinon at version 2 (3 not compatible with sinon-test yet)
  • Added npm run format to run for standard & prettier
  • Hide the err.stack from default error pages when env is production

To-do

  • Add more tests
  • Fix Safari "cannot decode raw data" error
  • Fix virtualDirectories

}
}

Public.prototype.openStream = function (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use an object argument instead? { res: res, file: file } ?

@@ -1,23 +1,27 @@
#! /usr/bin/env node

var fs = require('fs')
var path = require('path')
var fs = require("fs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single quotes preferred 😬

Copy link
Contributor

@jimlambie jimlambie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved 🐳

@dadi dadi deleted a comment from jimlambie Aug 11, 2017
@abovedave abovedave merged commit 3da2063 into master Aug 31, 2017
@abovedave abovedave deleted the feature/performance branch August 31, 2017 16:09
@adamkdean
Copy link
Contributor

This is an awesome effort @abovebored 🚀 🌔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants