performance tuning [name=...]

performance tuning [name=...]


I had some reports where people had a ton of radio/checkbox buttons
validated and experienced very poor performance. I'm still lacking a
proper performance testsuite, so I can't really verify if my experiments
yield anything better, so I'd like to ask for comments.
So far I had this to select all elements of the same name:
checkableGroup: function( element ) {
return jQuery(this.currentForm).find('[@name="' + element.name + '"]');
}
My improved solution is this:
checkableGroup: function( element ) {
var form = this.currentForm;
return jQuery(document.getElementsByName(element.name)).map(function(index, element) {
return element.form == form && element || null;
});
}
Does everyone agree that this will always perform better then the
previous solution? Any ideas for further improvements in this area?
Regards
Jörn