Improving script performance for looping unparalleled arrays
Instead of iterating through the inner array multiple times, it might be faster to create a map for the inner array beforehand and then test for a match within the map. (I think this will only work if they're arrays of strings, though.)

var arr_vals = ["74","f4e3","22","r31","17","hundernds"]; // could have 500+ items
var arr_items = ["r31","22","65","100"]; // could have 50 items

var vals_len = arr_vals.length;
var items_len = arr_items.length;

var map_items = {};
for(var j = 0; j &lt; items_len; ++j) {
  map_items[arr_items[j]] = 1;
}

for( var i = 0; i &lt; vals_len; ++i) {
  if(map_items[arr_vals[i]]) {
    // match!
  }
}


Perf test