Hacker News new | ask | show | jobs
by nicknyc 5324 days ago
Users stay on a website for more than 800ms.

Wouldn't it be more cost effective (rather than convert/port a whole site to a new js lib) to rewrite your page init JavaScript so it does not require a js lib at all (0ms)? Jquery would be async loaded by the time the user executes actions/buttons; if it had not loaded yet you wait, or show a loading icon, etc.

This porting/optimization adds no value to your users 6 months from now who are running a quad core nexus-razr-droid's browser that loads jquery in 300ms.

2 comments

Good point. For my particular app/use case, the user quickly opens the app, uses the camera, then closes the app and moves on -- which is why I'm optimizing load time. But even for that case, that technique is a great suggestion, and probably what I should have tried first. I'll try it next. :)
Moore's law is applied differently to mobile phones, as processing power is less important than battery life. And even if phones will get a lot more powerful, that's secondary to poor bandwidth, a problem that I bet we'll still have 4 years from now.

I use jQuery because it makes Javascript usage sane. Without it I would hate my job.

Have a play with CofffeeScript - perhaps it'll give you enough syntactic sugar that client-side frameworks become unnecessary.
CoffeeScript only takes care of syntax problems. It doesn't handle DOM traversing or other API related issues.