diff --git a/core/includes/config.inc b/core/includes/config.inc
index 00c7fa6..dc8df81 100644
--- a/core/includes/config.inc
+++ b/core/includes/config.inc
@@ -102,7 +102,7 @@ function config_get_storage_names_with_prefix($prefix = '') {
  *   A configuration object.
  */
 function config($name) {
-  return drupal_container()->get('config.factory')->get($name)->load();
+  return drupal_container()->get('config.factory')->get($name);
 }
 
 /**
@@ -141,11 +141,11 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf
     'delete' => array(),
   );
 
-  foreach (array_diff_assoc($target_config_data, $source_config_data) as $name => $value) {
+  foreach (array_diff_key($target_config_data, $source_config_data) as $name => $value) {
     $config_changes['delete'][] = $value['name'];
   }
 
-  foreach (array_diff_assoc($source_config_data, $target_config_data) as $name => $value) {
+  foreach (array_diff_key($source_config_data, $target_config_data) as $name => $value) {
     $config_changes['create'][] = $value['name'];
   }
 
@@ -200,6 +200,8 @@ function config_sync_changes(array $config_changes, StorageInterface $source_sto
  *   synchronization error, or NULL if there are no changes to synchronize.
  */
 function config_import() {
+  // Invalidate config objects.
+  drupal_container()->get('config.factory')->resetConfigs();
   // Retrieve a list of differences between staging and the active configuration.
   $source_storage = drupal_container()->get('config.storage.staging');
   $target_storage = drupal_container()->get('config.storage');
diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php
index 6fc2a87..c6a320e 100644
--- a/core/lib/Drupal/Core/Config/Config.php
+++ b/core/lib/Drupal/Core/Config/Config.php
@@ -65,6 +65,16 @@ class Config {
   protected $eventDispatcher;
 
   /**
+   * Whether the config object has already been loaded.
+   *
+   * Aside from TRUE or FALSE it can be NULL when inside load() to signal the
+   * "being loaded" phase.
+   *
+   * @var bool
+   */
+  protected $isLoaded = FALSE;
+
+  /**
    * Constructs a configuration object.
    *
    * @param string $name
@@ -88,6 +98,8 @@ public function __construct($name, StorageInterface $storage, EventDispatcher $e
    *   The configuration object.
    */
   public function init() {
+    $this->isLoaded = FALSE;
+    $this->overrides = array();
     $this->notify('init');
     return $this;
   }
@@ -120,6 +132,9 @@ public function setName($name) {
    *   TRUE if this config object does not exist in storage.
    */
   public function isNew() {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     return $this->isNew;
   }
 
@@ -151,6 +166,9 @@ public function isNew() {
    *   The data that was requested.
    */
   public function get($key = '') {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     if (!isset($this->overriddenData)) {
       $this->setOverriddenData();
     }
@@ -179,6 +197,11 @@ public function get($key = '') {
    *   The configuration object.
    */
   public function setData(array $data) {
+    // A load would destroy the data just set (for example on import). Do not
+    // set when inside load().
+    if (isset($this->isLoaded)) {
+      $this->isLoaded = TRUE;
+    }
     $this->data = $data;
     $this->resetOverriddenData();
     return $this;
@@ -243,6 +266,9 @@ protected function resetOverriddenData() {
    *   The configuration object.
    */
   public function set($key, $value) {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     // Type-cast value into a string.
     $value = $this->castValue($value);
 
@@ -309,6 +335,9 @@ public function castValue($value) {
    *   The configuration object.
    */
   public function clear($key) {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     $parts = explode('.', $key);
     if (count($parts) == 1) {
       unset($this->data[$key]);
@@ -327,6 +356,7 @@ public function clear($key) {
    *   The configuration object.
    */
   public function load() {
+    $this->isLoaded = NULL;
     $data = $this->storage->read($this->name);
     if ($data === FALSE) {
       $this->isNew = TRUE;
@@ -337,6 +367,7 @@ public function load() {
       $this->setData($data);
     }
     $this->notify('load');
+    $this->isLoaded = TRUE;
     return $this;
   }
 
@@ -347,6 +378,9 @@ public function load() {
    *   The configuration object.
    */
   public function save() {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     $this->storage->write($this->name, $this->data);
     $this->isNew = FALSE;
     $this->notify('save');
@@ -412,8 +446,12 @@ protected function notify($config_event_name) {
    *   The configuration object.
    */
   public function merge(array $data_to_merge) {
+    if (!$this->isLoaded) {
+      $this->load();
+    }
     // Preserve integer keys so that config keys are not changed.
     $this->data = NestedArray::mergeDeepArray(array($this->data, $data_to_merge), TRUE);
+    $this->resetOverriddenData();
     return $this;
   }
 }
diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php
index ca36ce7..3b1bfa6 100644
--- a/core/lib/Drupal/Core/Config/ConfigFactory.php
+++ b/core/lib/Drupal/Core/Config/ConfigFactory.php
@@ -38,6 +38,8 @@ class ConfigFactory {
    */
   protected $eventDispatcher;
 
+  protected $configs = array();
+
   /**
    * Constructs the Config factory.
    *
@@ -64,26 +66,18 @@ public function __construct(StorageInterface $storage, EventDispatcher $event_di
   public function get($name) {
     global $conf;
 
-    // @todo Caching the instantiated objects per name might cut off a fair
-    //   amount of CPU time and memory. Only the data within the configuration
-    //   object changes, so the additional cost of instantiating duplicate
-    //   objects could possibly be avoided. It is not uncommon for a
-    //   configuration object to be retrieved many times during a single
-    //   request; e.g., 'system.performance' alone is retrieved around 10-20
-    //   times within a single page request. Sub-requests via HttpKernel will
-    //   most likely only increase these counts.
-    // @todo Benchmarks were performed with a script that essentially retained
-    //   all instantiated configuration objects in memory until script execution
-    //   ended. A variant of that script called config() within a helper
-    //   function only, which inherently meant that PHP destroyed all
-    //   configuration objects after leaving the function. Consequently,
-    //   benchmark results looked entirely different. Profiling should probably
-    //   redone under more realistic conditions; e.g., actual HTTP requests.
+    if (isset($this->configs[$name])) {
+      return $this->configs[$name];
+    }
+
     // @todo The decrease of CPU time is interesting, since that means that
     //   ContainerBuilder involves plenty of function calls (which are known to
     //   be slow in PHP).
-    $config = new Config($name, $this->storage, $this->eventDispatcher);
-    return $config->init();
+    $this->configs[$name] = new Config($name, $this->storage, $this->eventDispatcher);
+    return $this->configs[$name]->init();
   }
 
+  function resetConfigs() {
+    $this->configs = array();
+  }
 }
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
index 6d0a3f4..af37199 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
@@ -287,9 +287,10 @@ public function save(EntityInterface $entity) {
       $id = $entity->getOriginalID();
     }
     $config = config($prefix . $id);
+    $is_new = $config->isNew();
     $config->setName($prefix . $entity->id());
 
-    if (!$config->isNew() && !isset($entity->original)) {
+    if (!$is_new && !isset($entity->original)) {
       $this->resetCache(array($id));
       $result = $this->load(array($id));
       $entity->original = reset($result);
@@ -303,7 +304,7 @@ public function save(EntityInterface $entity) {
       $config->set($key, $value);
     }
 
-    if (!$config->isNew()) {
+    if (!$is_new) {
       $return = SAVED_UPDATED;
       $config->save();
       $this->postSave($entity, TRUE);
@@ -382,6 +383,11 @@ protected function postSave(EntityInterface $entity, $update) {
     if ($update && !empty($entity->original) && $entity->{$this->idKey} !== $entity->original->{$this->idKey}) {
       // @todo This should just delete the original config object without going
       //   through the API, no?
+      // @todo: We try to delete the original here, but because ConfigFactory
+      //   still things the new one that has been renamed is the original, we
+      //   end up deleting the new config file instead of the old one. Clearing
+      //   the cache fixes this, but isn't the correct approach.
+      drupal_container()->get('config.factory')->resetConfigs();
       $entity->original->delete();
     }
   }
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
index 8e83a84..e2ddb59 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
@@ -64,7 +64,7 @@ function testConfOverride() {
     $this->assertIdentical($config->get('404'), $expected_original_data['404']);
 
     // Reload the configuration object.
-    $config = config('config_test.system');
+    $config->init();
 
     // Verify that it contains the overridden data from $conf.
     $this->assertIdentical($config->get('foo'), $conf['config_test.system']['foo']);
@@ -97,7 +97,7 @@ function testConfOverride() {
     unset($conf['config_test.system']);
 
     // Reload it and verify that it still contains the original data.
-    $config = config('config_test.system');
+    $config->init();
     $this->assertIdentical($config->get('foo'), $expected_original_data['foo']);
     $this->assertIdentical($config->get('baz'), $expected_original_data['baz']);
     $this->assertIdentical($config->get('404'), $expected_original_data['404']);
diff --git a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php b/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php
index adfe0b9..0ae38a3 100644
--- a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php
+++ b/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php
@@ -37,7 +37,7 @@ function testLocaleConfigOverride() {
     // Spoof multilingual.
     $GLOBALS['conf']['language_count'] = 2;
     drupal_language_initialize();
-    $config = config($name);
+    $config->init();
     $this->assertIdentical($config->get('foo'), 'en bar');
   }
 }
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 001e521..cb62f0c 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -1227,6 +1227,7 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a
           $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $headers));
           // Ensure that any changes to variables in the other thread are picked up.
           $this->refreshVariables();
+          drupal_container()->get('config.factory')->resetConfigs();
 
           // Replace original page output with new output from redirected page(s).
           if ($new = $this->checkForMetaRefresh()) {
