Index: src/wp-includes/user.php
===================================================================
--- src/wp-includes/user.php	(revision 42959)
+++ src/wp-includes/user.php	(working copy)
@@ -882,6 +882,23 @@
 	if ( ! $site_id ) {
 		$site_id = get_current_blog_id();
 	}
+
+	/**
+	 * Filter the user count before queries are run
+	 *
+	 * @since 5.0.0
+	 *
+	 * @param null|string $result Default null.
+	 * @param string $strategy Optional. The computational strategy to use when counting the users.
+	 *                           Accepts either 'time' or 'memory'. Default 'time'.
+	 * @param int|null $site_id Optional. The site ID to count users for. Defaults to the current site.
+	 */
+	$pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );
+
+	if ( null !== $pre ) {
+		return $pre;
+	}
+
 	$blog_prefix = $wpdb->get_blog_prefix( $site_id );
 	$result      = array();
 
