Using event capturing to improve Basecamp page load times
37signals.com
37signals.com
"If you’re looking to speed up page load times in your own projects, start by profiling. Then identify the hotspots and defer them until the furthest point of intent — where you know the user is about to perform the action you need to set up."
I would think that it's a bad user experience to experience a big pause right when they want to do something. Sure the page loads faster but a noticeable pause after a click would be tremendously annoying and contribute to the "laggy" feel.
After implementing deferred initialization I asked myself "does reordering feel laggy?" and the answer was no. If it had felt laggy then I'd have started profiling again.
For high-level measurements I use good old "new Date().getTime()". One call before, one call after, subtract the former from the latter and log it to the console.
When I want to dig deeper, I go to the WebKit Inspector's Profile tab. You can turn it on or off through the UI, or use console.profile()/console.profileEnd() in your code to control it programmatically.
Why not use `console.time` and `console.timeEnd` for that? They probably have the same resolution as the underlying date object and they're significantly less of a hassle.
Be mindful though that by deferring the setup of the sortable list until the mouse action, you will introduce UI lag to the user. Sure: The page might load a bit faster, but now users clicking on the sortable elements will have to wait longer for their click to register.
As an aside, it's ironic that as usual, the browsers which would profit the most from these kinds of speed optimizations don't support them to begin with.
It's also always the slowest browsers that require the polyfills with the worst performance characteristics.
Have a feeling you're going to regret that.
Finally made the decision to use redmine(http://www.redmine.org/) instead.
If they are meaning "something not from the stone age" (i.e. you need FF3.5+, Chrome or Opera of similar lineage, or IE9+) then I can understand not supporting IE8 or less. Increasingly people are deciding that it simply isn't cost effective to continue to support IE8 and its elder kin, the few lost sales that result being worth less than the cost in time and other resources committed to testing those environments (i.e. people are taking the opinion that someone using IE8 is a cost not a customer).
It is a decision that should not be taken lightly of course. I wish I could refuse to support IE6 and IE8 but our clients are large banks who really are stuck in the stone age in that regard. I assume that they fully considered the pros and cons of telling IE6/7/8 users to get stuffed before taking that path.
If you are stuck on IE8 or less then you have no choice but to vote with your wallet. If enough people do the same then they were wrong in their assessment and will have to reconsider. Given the target market, as I understand it, though: I don't think they are likely to be wrong.
Here's the full list of supported browsers: https://basecamp.com/browsers
And way to miss the forest for the trees, guys—this article isn't about IE at all. I've come to expect no less from the Hacker News crowd these days.
Back onto the main topic...
In my experience IE8 is the most important one to profile and speed up - since it is quite slower than other modern browsers. Spending time in the IE developer tools profiling can give some pretty good gains.
Moving expensive code into click handlers can have the drawback of making the user Touch Points, or where the user is doing interactivity slower. This is where users can often notice the slow down. But I'm guessing you managed to make it take less time than 200ms, and it's probably a little touched item anyway, so probably still worth it. The alternative is to spread the computation after load, so the user might not even notice it happen. Or if you're modifying the DOM, why not just do it before you send it to the user - and send them html which doesn't need a lot of javascript manipulation done.
It also brings up the point of testing and profiling. I noticed there was a bug report in your blog comments. It's really helpful to have tests before you start doing profiling, and especially once you have made your changes. Tools like speed.pypy.org are really nice for tracking performance regressions too. So, when a developer adds some new JS functionality into your app in 4 weeks time, you can see when the performance regression was added.
cya
I must admit my knee jerked a little on that one. I did the "reading comments before the article" thing and was responding to what I've seen in a number of places recently which is a minor backlash against dropping IE8 support. I've seen it in a couple of places over the last ~year (since there were predictions of Google dropping support in their Docs products when IE10 is officially released). The conversation goes:
IE8 User: I'm not paying to Upgrade Windows of learning a new browser, so if you don't support IE8 I'm going away
Others: Fair enough. We wish you luck in your future endeavours.
IE8 User: Hangs around and repeats the demand to be supported in the hope that if he shouts loud and often enough he'll be given his way just to shut him up. The word "unprofessional" gets an airing at this point.
I have bee in my bonnet about IE as I have no choice but to support as far back as 6 in my day job due to some of our banking clients being stuck in the stone age metaphorically speaking... If I win the lottery I'll never touch IE again due to the hassle it has caused me up til this point, even if it becomes the greatest browser in the world!