Is there an efficient way to dermine whether a node can be viewed by all users? I am trying to use the Drupal node access API to determine whether a node is subject to an access restriction. That is: I want to make sure that the node can be viewed by any authenticated user (provided the authenticated user is granted the right to view published content). 

The function node_access('view, $node, $account); returns TRUE if the user object $account can access $node, and FALSE otherwise, so I can get the correct result stored in $view_for_all with the following snippet of code:

$accounts = entity_load('user');
$view_for_all = TRUE;
foreach ($accounts as $account) {
  if (!node_access('view', $node, $account)) {
    $view_for_all = FALSE;
    break;
  }
}


However, looping through all accounts will be very slow if there are, say, 50000 users. I am looking for a more efficient way to do this.
If you are needing to check node_access records, then you may be able to examine them similarly to how devel_node_access does.  In the end, all nodes have grants added to the node_access table, so if there are grants that deny or restrictively add access, then you can probably see it there.

Another option would be to have a dummy account that is an authenticated user, and used as the test case.  This will fail, of course, if you need to detect grant rules that deny access to authenticated users who would otherwise be entitled.  It's a sticky situation.

The hardest part about this question is that it seems as though you are looking for a general solution to a specific problem, and I'm not quite sure that a general solution exists.