title: gsubfn: differences between perl and tclk?
body: <p>I'm surprised by the difference between these two:</p>
  
  <pre><code>strapply(state.name, "^(?:Al|Ma)(.).*(.)$", simplify=rbind, FUN=c, perl=T)
       [,1] [,2] [,3]
  [1,] "a"  "a"  ""  
  [2,] "a"  "a"  ""  
  [3,] "i"  "e"  ""  
  [4,] "r"  "d"  ""  
  [5,] "s"  "s"  ""  
  strapply(state.name, "^(?:Al|Ma)(.).*(.)$", simplify=rbind, FUN=c)
       [,1] [,2]
  [1,] "a"  "a" 
  [2,] "a"  "a" 
  [3,] "i"  "e" 
  [4,] "r"  "d" 
  [5,] "s"  "s" 
  </code></pre>
  
  <p>Is there an obvious explanation for this?  Clearly not a huge deal, especially since:</p>
  
  <pre><code>strapply(state.name, "^(?:Al|Ma)(.).*(.)$", simplify=rbind, FUN=c, perl=T, backref=-2)
  </code></pre>
  
  <p>forces the correct answer, but I'd like to make sure I understand the engine differences.  Presumably this is related to different backreference detection strategies?  From vignette:</p>
  
  <blockquote>
    <p>Since gsubfn uses a potentially time consuming trial and error algorithm to automatically determine the number of back references the performance can be sped up somewhat by specifying backref even if all back references are to be passed.</p>
  </blockquote>
  
  <p>Loosely related, can I generally assume that <code>tclk</code> is much faster than <code>pcre</code>?  Seems to be from some informal benchmarking.</p>