Index: src/wp-includes/ms-blogs.php
===================================================================
--- src/wp-includes/ms-blogs.php	(revision 41878)
+++ src/wp-includes/ms-blogs.php	(working copy)
@@ -462,13 +462,21 @@
 		}
 	}
 
-	switch ( $field ) {
-		case 'id':
-			if ( ! is_numeric( $value ) ) {
+	if ( 'id' === $field ) {
+		if ( ! is_numeric( $value ) ) {
+			return null;
+		}
+		$site = get_site( $value );
+		if ( $network_id && $site ) {
+			if ( $network_id != $site->network_id ) {
 				return null;
 			}
-			$args['site__in'][] = intval( $value );
-			break;
+		}
+
+		return $site;
+	}
+
+	switch ( $field ) {
 		case 'slug':
 			$network = get_network( $network_id );
 			if ( ! $network ) {
@@ -538,13 +546,28 @@
 
 	$args['number'] = 1;
 
-	$sites = get_sites( $args );
+	if ( $field == 'url' || $field == 'domain' ) {
+
+		$value     = str_replace( array( 'https://', 'http://' ), '', $value );
+		$cache_key = md5( $value );
+		$blog      = wp_cache_get( $cache_key, 'blog-lookup' );
+
+		if ( false !== $blog ) {
+			return $blog;
+		}
+	}
 
+	$sites = get_sites( $args );
 	if ( empty( $sites ) ) {
-		return null;
+		$site = null;
+	} else {
+		$site = array_shift( $sites );
+	}
+	if ( $field == 'url' || $field == 'domain' ) {
+		wp_cache_add( $cache_key, $site, 'blog-lookup' );
 	}
 
-	return array_shift( $sites );
+	return $site;
 }
 
 /**
