Script Preparation code:
AخA
 
var a = [1,2,2,2,3,4,5,6,8,4,5,8,4,6,3,5];
var b = [2,4];
Tests:
  • Best

     
    function array_diff(a, b) {
      return a.filter(function(x) { return b.indexOf(x) == -1; });
    }
  • Mine

     
    function array_diff(a, b) {
     let arrStr =  a.join('');
     b.forEach(function(item) {
       arrStr = arrStr.replace(new RegExp(item, 'g'), '');
     });
     
     return arrStr.split('').map(function(t){return parseInt(t)});
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Best
    Mine

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123 on Windows
View result in a separate tab
Test name Executions per second
Best 149050448.0 Ops/sec
Mine 146135952.0 Ops/sec