People, is there anybody who can help me. I am wondering which one is faster...

Calling this several times in a script:

var foo = $(data).find('foo').text();
var bar = $(data).find('bar').text();

Or wrapping it in a function:

var findData = function (data, field) {
	var v = $(data).find( field ).text();
	return v;
};

And calling that as many times:

var foo = findData(data,'foo');
var bar = findData(data,'bar');

I know that the last solution appeals to me more, maybe 'cause it looks cleaner. But what I am wondering, which is faster?

After reading the comments, I think I'll go for:

var $data = $(data);
  var foo = $data.find('foo').text();
  var bar = $data.find('bar').text();

Tip of the hat to Codepo8 / Chris