I think points 4 and 5 are just premature optimization.... The speed difference is meaningless.
There's no such thing as premature optimization or meaningless speed differences. Would you say the same thing if the code was in Java/C#/Ruby etc?
It may appear to make no difference on a site with hardly any JS interaction, but throw in a few plugins, a decent amount of AJAX and more than a handful of lines of JS and all of a sudden all those milliseconds have led to a delay of a few of seconds while your page finishes rendering.
Yes, many programmers would say exactly that in those languages. Code readability is very important.
This is a debate that flares up every year or so, but a lot of programmers generally consider premature optimization to be a complete waste of time and bad for your code. They would tell you to write clear code and use a profiler to find actual bottlenecks, not spend time fixing imagined ones.
Fair point, and I'd agree with you - I'd defo go over clearer code than something purely for premature optimization... except I think the examples given were MORE readable afterwards, at worst you've ended up with optimised code!
Problem with JS is that there is not as many optimization tools, aside from Firebug that I can think of. On top of that, personally, I'm a C# guy that does some JS and most people I know are like me. The other guys that do JS work for design agencies that are more front-end/HTML guys. Most of us aren't tooled up like in the C# world for optimization and rely on optimization tips - it's a lot easier to do these as you go along rather than retrospectively like you can with server languages. (I may well be missing a whole toolset here somewhere - be good to find more resources)
There's no such thing as premature optimization or meaningless speed differences. Would you say the same thing if the code was in Java/C#/Ruby etc?
It may appear to make no difference on a site with hardly any JS interaction, but throw in a few plugins, a decent amount of AJAX and more than a handful of lines of JS and all of a sudden all those milliseconds have led to a delay of a few of seconds while your page finishes rendering.