title: Fastest way to compare n arrays of integers in Swift
body: <p>I'm trying to find a really fast way of comparing n arrays of integers in Swift. Actually I'm looking to compare a struct, but the same principle applies. There are various ways I could do this using loops etc, but as the arrays will be large, and I need to do this at a high refresh rate I was wondering if anyone had any better ideas?</p>
  
  <pre><code>let array1 = [0,255,128]
  let array2 = [255,128,0]
  let array3 = [128,0,0]
  
  // result [255,255,128]
  </code></pre>
  
  <p>A more accurate example would be to find the highest 'priority' and then find the highest 'level' where priorities match </p>
  
  <pre><code>let array1 = [(level: 0, priority: 200),(level: 255, priority: 100), (level: 128, priority: 200)]
  let array2 = [(level: 255, priority: 100),(level: 128, priority: 100), (level: 0, priority: 0)]
  let array3 = [(level: 128, priority: 200),(level: 0, priority: 200), (level: 0, priority: 0)]
  
  // result [128,0,128]
  </code></pre>
  
  <p>Thanks so much</p>