title: Find the number of files in a directory
body: <p>Is there any method in Linux to calculate the number of files in a directory (that is, immediate children) in O(1) (independently of the number of files) without having to list the directory first? If not O(1), is there a reasonably efficient way?</p>
  
  <p>I'm searching for an alternative to <code>ls | wc -l</code>.</p>