title: Python: Fastest Way to compare arrays elementwise
body: <p>I am looking for the fastest way to output the index of the first difference of two arrays in Python. For example, let's take the following two arrays:</p>
  
  <pre><code>test1 = [1, 3, 5, 8]
  test2 = [1]
  test3 = [1, 3]
  </code></pre>
  
  <p>Comparing <code>test1</code> and <code>test2</code>, I would like to output <code>1</code>, while the comparison of test1 and test3 should output <code>2</code>.</p>
  
  <p>In other words I look for an equivalent to the statement:</p>
  
  <pre><code>import numpy as np
  np.where(np.where(test1 == test2, test1, 0) == '0')[0][0] 
  </code></pre>
  
  <p>with varying array lengths.</p>
  
  <p>Any help is appreciated.</p>