title: Faster alternative to deparse()
body: <p>I maintain a package that relies on repeated calls to <code>deparse(control = c("keepNA", "keepInteger"))</code>. <code>control</code> is always the same, and the expression varies. <code>deparse()</code> seems to spend a lot of time repeatedly interpreting the same set of options with <code>.deparseOpts()</code>.</p>
  
  <pre><code>microbenchmark::microbenchmark(
      a = deparse(identity, control = c("keepNA", "keepInteger")),
      b = .deparseOpts(c("keepNA", "keepInteger"))
  )
  # Unit: microseconds
  # expr min  lq  mean median  uq  max neval
  #    a 7.2 7.4 8.020    7.5 7.6 55.1   100
  #    b 3.0 3.2 3.387    3.4 3.5  6.0   100
  </code></pre>
  
  <p>On some systems, redundant <code>.deparseOpts()</code> calls actually take up the majority of the runtime of <code>deparse()</code> (<a href="https://user-images.githubusercontent.com/1580860/70091470-2aa1d180-15ea-11ea-9445-8258048474ca.png" rel="noreferrer">flame graph here</a>).</p>
  
  <p>I would really like to just call <code>.deparseOpts()</code> once and then supply the numeric code to <code>deparse()</code>, but that appears impossible without calling <code>.Internal()</code> or invoking the C code directly, neither of which is optimal from a package development perspective.</p>
  
  <pre><code>deparse
  # function (expr, width.cutoff = 60L, backtick = mode(expr) %in% 
  #     c("call", "expression", "(", "function"), 
  #     control = c("keepNA", "keepInteger", "niceNames", 
  #         "showAttributes"), nlines = -1L) 
  # .Internal(deparse(expr, width.cutoff, backtick, .deparseOpts(control), 
  #     nlines))
  # &lt;bytecode: 0x0000000006ac27b8&gt;
  # &lt;environment: namespace:base&gt;
  </code></pre>
  
  <p>Is there a convenient workaround?</p>