Benchmark.js

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<ul id='cycleResults'>

</ul>
<div id="result">

</div>
<br>
<button id="btn">
Run Tests
</button>

JavaScript

var ar = [1,2,3,4,5,6,7,8,9,10,1231,12312,5436,5756756,2423,12315,2352,11241,35453,35151,23,241,564,457,343,2423,1423,2253,1421,13213,14124,1525235,124,5467657,8568568,34534,43,12,45,876,98,34,234,243,36,567,85,78,789,32,46,57,68,67,678,346,35,46,57,67,78,78,234,23,42,456456,456456,465456,45645,6457657,867867,9789989,9999999,9678567,3453,345,3542,42,2352,5,36,456,4547,47,47,457,567,57,57745,57,57,56,57,57,56,57,57,5,567,879,789789,35235,423,6457457,86578768,56756756,345345,6456];
var str = "12345678910123112312543657567562423123152352112413545335151232415644573432423142322531421132131412415252351245467657856856834534431245876983423424336567857878932465768676783463546576778782342342456456456456465456456456457657867867978998999999999678567345334535424223525364564547474745756757577455757565757565757556787978978935235423645745786578768567567563453456456";

function test1()
{
	return ar.includes(867867);
}

function test2()
{
	return str.includes("867867");
}

var cycleResults = document.getElementById('cycleResults');
var result = document.getElementById('result');
var btn = document.getElementById('btn');

// BENCHMARK ====================
btn.onclick = function runTests(){

  btn.setAttribute('disable', true);
	cycleResults.innerHTML = '';
  result.textContent = 'Tests running...';
  
  var suite = new Benchmark.Suite;

  // add tests
  suite
  .add('test1', test1)
  .add('test2', test2)
  // add listeners
  .on('cycle', function(event) {
    var result = document.createElement('li');
    result.textContent = String(event.target);
    
    document.getElementById('cycleResults')
    	.appendChild(result);
  })
  .on('complete', function() {
    result.textContent = 'Fastest is ' + this.filter('fastest').pluck('name');
    btn.setAttribute('disable', false);
  })
  // run async
  .run({ 'async': true });
};