Tags

, , , ,

Today I had to optimize a slow running page. We use MiniProfiler which makes finding such issues a breeze. But this time it was a little bit more difficult: MiniProfiler showed over 200 hundred SQL queries. How to find the slow ones? Maybe I miss something but it seems there is no built in way to filter MiniProfiler results. I came up with quick jQuery snippet to do just that:

// show only slow rows (100ms+)
$('.profiler-info div:last-child')
    .filter(function () {
        // all but having 3+ digit times
        return !$(this).text().match(/^\d{3}.*/);
    })
    .parent()
    .parent()
    .hide()     // tr.profiler-odd
    .next()
    .hide();    // tr.profiler-gap-info

Just run it inside browser’s Console window and result should look like this:

filtering-mini-profiler

Advertisements