The example in the question is over-use IMO not because of performance concerns, but because the plain JavaScript version is considerably more readable.
Similarly, td.cellIndex
and tr.rowIndex
are much more readable (as well as faster) than the commonly-given hacks like $(this).parent().children().index(this)
, and simple properties like this.checked
is IMO better than $(this).is(':checked')
.
Within jQuery itself, you should prefer to use jQuery wrapper methods rather than the versions wrapped into non-standard selectors.
$('#thing .thing').last()
can be fast because the selector will be handed off to the fast built-in querySelectorAll
call on modern browsers.
$('#thing .thing:last')
will be relatively slow.
Also watch out for selector string-slinging, which is usually a bad thing:
$('div.'+className)
is going to break as soon as there's a className with a dot (or various other punctuation) in it. Avoid making a selector string if there's a more reliable way to test.