 core/modules/comment/comment.module                |   34 ++++++++++++++++++++
 .../FieldFormatter/CommentDefaultFormatter.php     |   19 ++++++++++-
 .../comment/Plugin/Field/FieldType/CommentItem.php |    1 +
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 4ffcb4b..786b2fa 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1803,3 +1803,37 @@ function comment_library_info() {
   );
   return $libraries;
 }
+
+/**
+ * #post_render_cache callback; inserts the comment form.
+ *
+ * @param array $element
+ *   A render array with the following keys:
+ *   - #markup
+ *   - #attached
+ * @param array $context
+ *   An array with the following keys:
+ *   - entity_type: an entity type
+ *   - entity_id: an entity ID
+ *   - field_name: a comment field name
+ * @param string $token
+ *   A token to uniquely identify this placeholder.
+ *
+ * @return array $element
+ *   The updated $element.
+ */
+function comment_insert_form(array $element, array $context, $token) {
+  // Build comment form based on stored context.
+  $entity = entity_load($context['entity_type'], $context['entity_id']);
+  $comment_form = comment_add($entity, $context['field_name']);
+
+  // Update the renderable.
+  if (!isset($element['#attached'])) {
+    $element['#attached'] = array();
+  }
+  $element['#attached'] = drupal_merge_attachments($element['#attached'], drupal_render_collect_attached($comment_form, TRUE));
+  $placeholder = drupal_render_cache_generate_placeholder(__FUNCTION__, $context, $token);
+  $element['#markup'] = str_replace($placeholder, drupal_render($comment_form), $element['#markup']);
+
+  return $element;
+}
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index ebfa3c6..f7636dc 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -138,7 +138,24 @@ public function viewElements(FieldItemListInterface $items) {
       if ($status == COMMENT_OPEN && $comment_settings['form_location'] == COMMENT_FORM_BELOW) {
         // Only show the add comment form if the user has permission.
         if ($this->currentUser->hasPermission('post comments')) {
-          $output['comment_form'] = comment_add($entity, $field_name);
+          // All users in the "anonymous" role can use the same form: it is fine
+          // for this form to be stored in the render cache.
+          if ($this->currentUser->isAnonymous()) {
+            $output['comment_form'] = comment_add($entity, $field_name);
+          }
+          // All other users need a user-specific form, which would break the
+          // render cache: hence use a #post_render_cache callback.
+          else {
+            $output['comment_form'] = array(
+              '#type' => 'render_cache_placeholder',
+              '#callback' => 'comment_insert_form',
+              '#context' => array(
+                'entity_type' => $entity->entityType(),
+                'entity_id' => $entity->id(),
+                'field_name' => $field_name
+              ),
+            );
+          }
         }
       }
 
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php
index c91f1bb..0f83f91 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php
@@ -150,6 +150,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
     $element['comment']['form_location'] = array(
       '#type' => 'checkbox',
       '#title' => t('Show reply form on the same page as comments'),
+      '#description' => t('Beware! This makes the page inherently slower for logged in users.'),
       '#default_value' => $settings['form_location'],
     );
     $element['comment']['preview'] = array(
