Index: wp-includes/author-template.php
===================================================================
--- wp-includes/author-template.php	(revision 6528)
+++ wp-includes/author-template.php	(working copy)
@@ -442,66 +442,78 @@
 	$r = wp_parse_args( $args, $defaults );
 	extract($r, EXTR_SKIP);
 
+	$exclude_admin = $exclude_admin ? "WHERE user_login <> 'admin'" : '';
+
 	$return = '';
 
-	/** @todo Move select to get_authors(). */
-	$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
+	$authors = (array) $wpdb->get_results("
+		SELECT $wpdb->users.ID, user_nicename, display_name, COUNT($wpdb->posts.ID) AS posts
+		FROM $wpdb->users " . (!$hide_empty ? 'LEFT' : '') . " JOIN $wpdb->posts
+			ON  $wpdb->posts.post_author = $wpdb->users.ID AND post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . "
+		$exclude_admin
+		GROUP BY post_author
+		ORDER BY display_name");
 
-	$author_count = array();
-	foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row) {
-		$author_count[$row->post_author] = $row->count;
-	}
+	if ( empty($authors) ) return false;
 
-	foreach ( (array) $authors as $author ) {
-		$author = get_userdata( $author->ID );
-		$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
-		$name = $author->display_name;
+	if ( $show_fullname ) {
+		$user_ids = $wpdb->get_col(null);
 
-		if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
-			$name = "$author->first_name $author->last_name";
+		$meta = (array) $wpdb->get_results("
+			SELECT user_id, meta_key, meta_value
+			FROM $wpdb->usermeta
+			WHERE user_id IN (" . join(',', $user_ids) . ") AND (meta_key = 'first_name' OR meta_key = 'last_name')
+			ORDER BY meta_key, meta_value, user_id");
 
-		if ( !($posts == 0 && $hide_empty) )
-			$return .= '<li>';
-		if ( $posts == 0 ) {
-			if ( !$hide_empty )
-				$link = $name;
-		} else {
-			$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
+		$user_meta = array();
+		foreach ($meta as $v)
+			$user_meta[$v->user_id][$v->meta_key] = $v->meta_value;
+	}
 
-			if ( (! empty($feed_image)) || (! empty($feed)) ) {
-				$link .= ' ';
-				if (empty($feed_image))
-					$link .= '(';
-				$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
+	foreach ($authors as $author) {
+		$name = $author->display_name;
+		if ( $show_fullname && !empty($user_meta[$author->ID]['first_name']) && !empty($user_meta[$author->ID]['last_name']) )
+			$name = trim($user_meta[$author->ID]['first_name'] . ' ' . $user_meta[$author->ID]['last_name']);
 
-				if ( !empty($feed) ) {
-					$title = ' title="' . $feed . '"';
-					$alt = ' alt="' . $feed . '"';
-					$name = $feed;
-					$link .= $title;
-				}
+		if ( $hide_empty && 0 == $author->posts ) {
+			$return .= '<li>' . $name . '</li>';
+			continue;
+		}
+		$return .= '<li>';
+		$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
 
-				$link .= '>';
+		if ( (! empty($feed_image)) || (! empty($feed)) ) {
+			$link .= ' ';
+			if (empty($feed_image))
+				$link .= '(';
+			$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
 
-				if ( !empty($feed_image) )
-					$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
-				else
-					$link .= $name;
+			if ( !empty($feed) ) {
+				$title = ' title="' . $feed . '"';
+				$alt = ' alt="' . $feed . '"';
+				$name = $feed;
+				$link .= $title;
+			}
 
-				$link .= '</a>';
+			$link .= '>';
 
-				if ( empty($feed_image) )
-					$link .= ')';
-			}
+			if ( !empty($feed_image) )
+				$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
+			else
+				$link .= $name;
 
-			if ( $optioncount )
-				$link .= ' ('. $posts . ')';
+			$link .= '</a>';
 
+			if ( empty($feed_image) )
+				$link .= ')';
 		}
 
-		if ( !($posts == 0 && $hide_empty) )
-			$return .= $link . '</li>';
+		if ( $optioncount )
+			$link .= ' ('. $author->posts . ')';
+
+		$return .= $link . '</li>';
 	}
+
 	if ( !$echo )
 		return $return;
 	echo $return;
