More efficient Wordpress-query parsing? (get_posts($query))
What is the most efficient way (time-wise) to count number of posts returned from a query and parse the posts returned? 

**PART 1:**

I currently have this code:

    /* $query = {
    'numberposts' = '15',
    'queryvar1' = '…',
    'queryvar2' = '…';
    }
    */
    $lastposts = get_posts($query); // This uses the original query, and will only return 15 results
	
	$print['returnedcount'] = count($lastposts); // Uses some resources (+ acceptable time)

	$query['numberposts'] = "-1"; // Get total results from query 
	$print['totalposts'] = count(get_posts($query)); // Uses lots of resources (+ lots of time)


I have no use for the other data this second `get_posts($query)`-provides me with, how can I speed that up? I only need to count the total number of posts returned by the query (except the `numberposts`-value. 

**PART 2:**

The `$lastposts`-object will be used later to get post data (ID, date, title, comment count, thumbnail and author ID).

These datas are inputed into the `$print`-array like this:

	foreach ($lastposts as $post){
		// ID
		$print['id'][] = (string)$post->ID;
		// Date
		$print['date'][] = (string)$post->post_date;
		// Title
		$print['title'][] = (string)$post->post_title;
		// Comment count
		$print['comments'][] = (string)$post->comment_count;
		// Images
		$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
		$print['image'][] = (string)$image[0];
		$imageRetina = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
		$print['imageretina'][] = (string)$imageRetina[0];
		// Author
		$print['author'][] = (string)$post->post_author;
	}
	
Is there a more time-efficient way to do this? I have noticed that the image-actions do take quite some time. 


Thanks alot!
More efficient Wordpress-query parsing? (get_posts($query))
===

What is the most efficient way (time-wise) to count number of posts returned from a query and parse the posts returned? 

**PART 1:**

I currently have this code:

    /* $query = {
    'numberposts' = '15',
    'queryvar1' = '…',
    'queryvar2' = '…';
    }
    */
    $lastposts = get_posts($query); // This uses the original query, and will only return 15 results
	
	$print['returnedcount'] = count($lastposts); // Uses some resources (+ acceptable time)

	$query['numberposts'] = "-1"; // Get total results from query 
	$print['totalposts'] = count(get_posts($query)); // Uses lots of resources (+ lots of time)


I have no use for the other data this second `get_posts($query)`-provides me with, how can I speed that up? I only need to count the total number of posts returned by the query (except the `numberposts`-value. 

**PART 2:**

The `$lastposts`-object will be used later to get post data (ID, date, title, comment count, thumbnail and author ID).

These datas are inputed into the `$print`-array like this:

	foreach ($lastposts as $post){
		// ID
		$print['id'][] = (string)$post->ID;
		// Date
		$print['date'][] = (string)$post->post_date;
		// Title
		$print['title'][] = (string)$post->post_title;
		// Comment count
		$print['comments'][] = (string)$post->comment_count;
		// Images
		$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
		$print['image'][] = (string)$image[0];
		$imageRetina = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
		$print['imageretina'][] = (string)$imageRetina[0];
		// Author
		$print['author'][] = (string)$post->post_author;
	}
	
Is there a more time-efficient way to do this? I have noticed that the image-actions do take quite some time. 


Thanks alot!