title: Is there a faster alternative to np.diff?
body: <p>I'm concerned with the speed of the following function:</p>
  
  <pre><code>def cch(tau):
      return np.sum(abs(-1*np.diff(cartprod)-tau)&lt;0.001)
  </code></pre>
  
  <p>Where <code>"cartprod"</code> is a variable for a list that looks like this:</p>
  
  <pre><code>cartprod = np.ndarray([[0.0123,0.0123],[0.0123,0.0459],...])
  </code></pre>
  
  <p>The length of this list is about 25 million. Basically, I'm trying to find a significantly faster way to return a list of differences for every pair list in that <code>np.ndarray</code>. Is there an algorithmic way or function that's faster than <code>np.diff</code>? Or, is <code>np.diff</code> the end all be all? I'm also open to anything else.</p>
  
  <p>EDIT: Thank you all for your solutions!</p>