2011-10-25

Do those stylesheets really need to be in the page body?

I once worked on a medium size enterprise software project that felt very sluggish and slow. I was new to the technology stack, new to anything but small web applications and I figured it just wasn't possible to get that particular stack any faster.

As the project went on features were added, more optimizations were added by expensive consultants,  a few performance regressions were weeded out but the app was still as sluggish as ever until one day the ux designer came and asked if there was any reason the consultants needed the stylesheet in the page body instead of in the head.

There wasn't, and at the next deploy the app was suddenly a whole lot faster and smoother. So much for the cruft of StringBuilder for every string concatenation. So much for higly efficient log statements, each spanning three lines, applied liberally across the whole codebase.

From that day on I became a little more pragmatic, a little less uninformed regarding that particular stack, the expensive consultants that happend to know it and optimizations for web applications.

Disclaimer: Of course, I'm not saying you should ditch StringBuilder and stop checking if debugIsEnabled() in thight loops, but in the average controller code in the average enterprise web project I guess they won't matter much.

1 comment: