title: why is ^A|bA slower than negative lookbehind with grep -P, but fast with grep -E?
body: <p>These are equivalent:</p>
  
  <pre><code>grep -E '^A|bA'
  grep -P '^A|bA'
  grep -P '(?&lt;![^b])A'
  </code></pre>
  
  <p>But the second one, <code>grep -P '^A|bA'</code>, is multiple times slower. Why?</p>
  
  <p>They all find the same thing: a line with an <code>A</code> at the beginning or after a <code>b</code>. (Equivalently, a line with an <code>A</code> not preceded by anything other than a <code>b</code>.)</p>
  
  <p>Is the second line disabling some optimization? Does <code>grep</code> check multiple characters in parallel when it thinks that's faster? I can't come up with another explanation, unless the <code>^</code> or <code>|</code> means something subtly different in perl.</p>