bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

Serving files via HTTP2 #673

Open danielcompton opened 6 years ago

danielcompton commented 6 years ago

I think using HTTP2 would greatly improve the page load performance of projects using Figwheel. Anecdotal reports on Clojurians also suggest this is the case for ClojureScript dev projects. With HTTP 1.1, browsers will only open up to 6 requests at a time to a single origin. This means that lots of the static file requests end up blocked, waiting in line. With HTTP2, this wait would be eliminated as the browser can make many requests over a single stream.

It would be interesting to see what would be involved for Figwheel to serve assets over HTTP2, and to quantify the performance improvements. It would need to be an opt-in thing, because HTTP2 requires SSL, even in localhost, and setting that up can be a bit of a pain.

bhauman commented 6 years ago

In the new version of the figwheel repl/server I'm using jetty so this certainly seems possible, SSL is also another possibility.

danielcompton commented 6 years ago

Another idea I had would be to somehow serve :optimisations :white-space for initial page load (or just concatenate the files manually), but for all incremental reloads, serve only the updated files. That sounds pretty tricky though.

bhauman commented 6 years ago

Yeah I thought about that a while back and it is very tricky.

iambumblehead commented 6 years ago

Respectfully, I hope figwheel gains the ability to start an https service.

In the node ecosystem there are various key-generating tools such as this one. Throw-away keys are fine for development.