google-chrome-devtoolspage-load-timeview-source

Why do some websites take longer to load when clicking "view source"?


I'm trying to figure out how the sublime text community package list works over at http://wbond.net/sublime_packages/community

The page itself displays after about a second and seems fine to use. You can inspect element too, and that also works fine, the dev tools window opens up straight away.

But if you click "view source", it takes absolutely ages for the source code to display. I've tried this on lots of different browsers. Why is this?


Solution

  • The slowness is caused by the syntax highlighter. Chrome's view-source: attempts to highlight the whole file at once, which takes some time on a 1.5MB file.

    Press Shift + Esc to show Chrome's Task Manager, and you will see that the CPU shoots up on "view source". If you wait a little longer, the "Page(s) Unresponsive" dialog will show up (as shown below).

    This bug has been reported before at https://code.google.com/p/chromium/issues/detail?id=128293