diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php
index adbf85d..23befa0 100644
--- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php
+++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Database\Connection;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -73,6 +74,13 @@ class MenuTree implements MenuTreeInterface {
   protected $state;
 
   /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
    * A list of active trail paths keyed by $menu_name.
    *
    * @var array
@@ -133,8 +141,10 @@ class MenuTree implements MenuTreeInterface {
    *   The entity query factory.
    * @param \Drupal\Core\State\StateInterface $state
    *   The state.
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler.
    */
-  public function __construct(Connection $database, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, RequestStack $request_stack, EntityManagerInterface $entity_manager, QueryFactory $entity_query_factory, StateInterface $state) {
+  public function __construct(Connection $database, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, RequestStack $request_stack, EntityManagerInterface $entity_manager, QueryFactory $entity_query_factory, StateInterface $state, ModuleHandlerInterface $module_handler) {
     $this->database = $database;
     $this->cache = $cache_backend;
     $this->languageManager = $language_manager;
@@ -142,6 +152,7 @@ public function __construct(Connection $database, CacheBackendInterface $cache_b
     $this->menuLinkStorage = $entity_manager->getStorage('menu_link');
     $this->queryFactory = $entity_query_factory;
     $this->state = $state;
+    $this->moduleHandler = $module_handler;
   }
 
   /**
@@ -428,7 +439,7 @@ public function buildTree($menu_name, array $parameters = array()) {
     // Build the menu tree.
     $tree = $this->doBuildTree($menu_name, $parameters);
     // Check access for the current user to each item in the tree.
-    $this->checkAccess($tree);
+    $this->doCheckAccess($tree);
     return $tree;
   }
 
@@ -513,13 +524,77 @@ protected function doBuildTree($menu_name, array $parameters = array()) {
    *   The menu tree you wish to operate on.
    */
   protected function checkAccess(&$tree) {
+    $node_links = array();
+    if ($this->moduleHandler->moduleExists('node')) {
+      $this->collectNodeLinks($tree, $node_links);
+      $this->doCheckNodeQueryAccess($node_links);
+    }
+    $this->doCheckAccess($tree);
+  }
+
+  /**
+   * Collects all node links in the tree.
+   *
+   *
+   * @param array $tree
+   *   The menu tree you wish to operate on.
+   * @param array $node_links
+   *   References to the links in the menu tree pointing to nodes.
+   */
+  protected function collectNodeLinks(&$tree, &$node_links) {
+    foreach ($tree as $key => $v) {
+      if ($tree[$key]['link']['route_name'] == 'node.view') {
+        $nid = $tree[$key]['link']['route_parameters']['node'];
+        if (is_numeric($nid)) {
+          $node_links[$nid][$tree[$key]['link']['mlid']] = &$tree[$key]['link'];
+          $tree[$key]['link']['access'] = FALSE;
+        }
+      }
+      if ($tree[$key]['below']) {
+        $this->collectNodeLinks($tree[$key]['below'], $node_links);
+      }
+    }
+  }
+
+  /**
+   * Performs a node access query to optimize the access checking later.
+   *
+   * The idea is to set access to TRUE, so _menu_link_translate no longer has to
+   * do it.
+   *
+   * @param array $node_links
+   *   References to the links in the menu tree pointing to nodes.
+   */
+  protected function doCheckNodeQueryAccess(&$node_links = array()) {
+    if ($node_links) {
+      $nids = array_keys($node_links);
+      $query = $this->queryFactory->get('node');
+      $query->condition('nid', $nids);
+      $query->condition('status', NODE_PUBLISHED);
+      $nids = $query->execute();
+      foreach ($nids as $nid) {
+        foreach ($node_links[$nid] as $mlid => $link) {
+          $node_links[$nid][$mlid]['access'] = TRUE;
+        }
+      }
+    }
+  }
+
+
+  /**
+   * Sorts the menu tree and recursively checks access for each item.
+   *
+   * @param array $tree
+   *   The menu tree you wish to operate on.
+   */
+  protected function doCheckAccess(&$tree) {
     $new_tree = array();
     foreach ($tree as $key => $v) {
       $item = &$tree[$key]['link'];
       $this->menuLinkTranslate($item);
       if ($item['access'] || ($item['in_active_trail'] && strpos($item['href'], '%') !== FALSE)) {
         if ($tree[$key]['below']) {
-          $this->checkAccess($tree[$key]['below']);
+          $this->doCheckAccess($tree[$key]['below']);
         }
         // The weights are made a uniform 5 digits by adding 50000 as an offset.
         // After _menu_link_translate(), $item['title'] has the localized link
@@ -538,7 +613,8 @@ protected function checkAccess(&$tree) {
    */
   public function buildTreeData(array $links, array $parents = array(), $depth = 1) {
     $tree = $this->doBuildTreeData($links, $parents, $depth);
-    $this->checkAccess($tree);
+
+    $this->CheckAccess($tree);
     return $tree;
   }
 
diff --git a/core/modules/menu_link/menu_link.services.yml b/core/modules/menu_link/menu_link.services.yml
index 88f5037..891741c 100644
--- a/core/modules/menu_link/menu_link.services.yml
+++ b/core/modules/menu_link/menu_link.services.yml
@@ -1,7 +1,7 @@
 services:
   menu_link.tree:
     class: Drupal\menu_link\MenuTree
-    arguments: ['@database', '@cache.data', '@language_manager', '@request_stack', '@entity.manager', '@entity.query', '@state']
+    arguments: ['@database', '@cache.data', '@language_manager', '@request_stack', '@entity.manager', '@entity.query', '@state', '@module_handler']
   menu_link.static:
     class: Drupal\menu_link\StaticMenuLinks
     arguments: ['@module_handler']
