diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 914228e..7afe346 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -96,6 +96,7 @@ function _simpletest_format_summary_line($summary) {
  *   The test ID.
  */
 function simpletest_run_tests($test_list, $reporter = 'drupal') {
+  simpletest_clean_cache();
   $test_id = db_insert('simpletest_test_id')
     ->useDefaults(array('test_id'))
     ->execute();
@@ -330,6 +331,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
 function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
   if ($success) {
     drupal_set_message(t('The test run finished in @elapsed.', array('@elapsed' => $elapsed)));
+    simpletest_clean_cache();
   }
   else {
     // Use the test_id passed as a parameter to _simpletest_batch_operation().
@@ -633,6 +635,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
  * Removes all temporary database tables and directories.
  */
 function simpletest_clean_environment() {
+  simpletest_clean_cache();
   simpletest_clean_database();
   simpletest_clean_temporary_directories();
   if (\Drupal::config('simpletest.settings')->get('clear_results')) {
@@ -649,6 +652,20 @@ function simpletest_clean_environment() {
 }
 
 /**
+ * Removes all temporary database tables corresponding the an initial install.
+ *
+ * These tables are created during the first test of a test run, after the
+ * temporary site has been set up. Further tests use these tables instead of
+ * reinstalling Drupal.
+ */
+function simpletest_clean_cache() {
+  $tables = db_find_tables('fasttest%');
+  foreach ($tables as $table) {
+    db_drop_table($table);
+  }
+}
+
+/**
  * Removes prefixed tables from the database from crashed tests.
  */
 function simpletest_clean_database() {
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index a120883..8fe53bf 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -850,7 +850,7 @@ protected function setUp() {
 
     // Execute the non-interactive installer.
     require_once DRUPAL_ROOT . '/core/includes/install.core.inc';
-    install_drupal($parameters);
+    $this->installDrupal($parameters);
 
     // Import new settings.php written by the installer.
     drupal_settings_initialize();
@@ -940,6 +940,59 @@ protected function setUp() {
   }
 
   /**
+   * Installs Drupal, using the cached database tables if possible.
+   *
+   * If the cached database tables are not available, create them for
+   * use by further tests.
+   */
+  function installDrupal($settings = array()) {
+    if ($this->tableExistsOnHost('fasttest_users')) {
+      $this->copyTablesOnHost('fasttest_', $this->databasePrefix);
+      install_drupal($settings + array('database_verified' => TRUE));
+    }
+    else {
+      install_drupal($settings);
+      $this->copyTablesOnHost($this->databasePrefix, 'fasttest_');
+    }
+  }
+
+  /**
+   * Return TRUE if a given table exists on the host environment.
+   */
+  function tableExistsOnHost($table) {
+    Database::renameConnection('default', 'simpletest_swap');
+    Database::renameConnection('simpletest_original_default', 'default');
+    $return = db_table_exists($table);
+    Database::renameConnection('default', 'simpletest_original_default');
+    Database::renameConnection('simpletest_swap', 'default');
+    return $return;
+  }
+
+  /**
+   * Copies all tables with one prefix and give them another prefix, on host.
+   *
+   * @param $sourceprefix
+   *   Prefix of tables to be copied (source).
+   * @param $destinationprefix
+   *   New prefix for copied tables.
+   */
+  function copyTablesOnHost($sourceprefix, $destinationprefix) {
+    Database::renameConnection('default', 'simpletest_swap');
+    Database::renameConnection('simpletest_original_default', 'default');
+    $tables = db_find_tables($sourceprefix . '%');
+    foreach ($tables as $table) {
+      $table = str_replace($sourceprefix, '', $table);
+      if (db_table_exists($destinationprefix . $table)) {
+        break;
+      }
+      db_query('CREATE TABLE ' . $destinationprefix . $table . ' LIKE ' . $sourceprefix . $table . ';');
+      db_query('INSERT INTO ' . $destinationprefix . $table . ' SELECT * FROM ' . $sourceprefix . $table);
+    }
+    Database::renameConnection('default', 'simpletest_original_default');
+    Database::renameConnection('simpletest_swap', 'default');
+  }
+
+  /**
    * Returns the parameters that will be used when Simpletest installs Drupal.
    *
    * @see install_drupal()
