Wednesday, February 04, 2009

Why ninjas are cool

No. You are wrong. This is not yet another rant about why Dusk of Ninja & Brush is a totally awesome game. This is real ninja stuff! .NET ninja stuff – but you catch my drift.

Today I went to a Tech Talk at microsoft about ASP.NET performance. Usually these talks contain just enough to not be a complete waste of time – but they are seldomly totally awesome. Today was different. Today a ninja was doing the talk. The Ninja was Mads Kristensen. I have been reading his blog for a while, and knew that he was good. But seeing him live was a whole other ballgame. The dude knows his tech and how to present it.

First of all he cut straight to the chase saying that usually when you talk about ASP.NET optimization – or when MSDN does anyway – they talk about how optimize all the backend stuff. The point is that this matters – but not as much as you think. Usually that part of serving the page takes up less than 10% of the total time the page takes to load… What takes the other 90% is all the CSS, JS and image content stuff. So that is really where you want to optimize.

Taking it from there he ran at a gracefully fast ninja tempo through techniques like minifying, compression, outputcaching, http caching and a lot of other stuff. Techniques that I knew, but I am really underutilizing because they are somewhat hard to get into and get to work properly. Mads showed me that it was just because I was trying to use a screwdriver to drive in a nail. With a lot of handlers and helpers page, most of which were dead simple 1digit-liners, he transformed an albeit simple site page using ASP.NET AJAX, external CSS and JS from 18 HTTP requests and 200K down to 5 requests and 30K – 0K on following requests when cached. Yes – that is no content. Driving the YSlow score up to a whopping 93.

You of course have to use some thought on how to manage caching if you have a highly dynamic site. But with his handlers and helpers in that was pretty simple too. Bottom line – this can be used on almost any ASP.NET site with very little effort. I just can’t wait to get my hands on this code!

Mads. You are truly a ninja. Keep up the great work.

No comments: