Speeding up Rails for Ember apps


#1

I noticed that quite a few ember devs end up enabling asset bundling in dev to avoid the ridiculous reload costs.

It really bothered me cause I felt it compromised the debug experience.

So … I put this in place

For Discourse with 800 assets I am seeing 1.5 second reload times as opposed to 4.5 prior to this fix.

I discovered that walking the middleware stack to reach the router and finally sprockets, was taking 14ms per resource, this patch places middleware in the front of the stack that ensures assets with matching etags get a 304 status code MUCH earlier (within 1 ms).

The end result is a much improved debugging experience. In fact, when I compared this to serving a single bundled asset (one css and one js file) performance was on par. Meaning this performs pretty much as well as source maps.

I have some ideas on ways to speed this up further but they involve more comprehensive changes and would probably work less well for css files.


#2

Are you using Keep-alive headers as well? Might help by reusing some of those HTTP requests…


#3

I use thin with nginx in front for dev and it all seems to work transparently wrt keepalives with no extra config, not that a few extra roundtrips at 0ms latency would make much of a diff :smile: