arr

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
arr
function whichSideOfTheForce(name) {
  const light = ['Luke', 'Obi-Wan', 'Yoda']; 
  const dark = ['Vader', 'Palpatine'];
  
  return light.includes(name) ? 'light' : 
    dark.includes(name) ? 'dark' : 'unknown';
};
whichSideOfTheForce('Yoda');
whichSideOfTheForce('Palpatine');
whichSideOfTheForce('Anakin');
ready
map
const light = new Map(...['Luke', 'Obi-Wan', 'Yoda']);

const dark = new Map(...['Vader', 'Palpatine']);
function whichSideOfTheForce(name) {
	return light.has(name) ? 'light' : dark.has(name) ? 'dark' : 'unknown';
}
whichSideOfTheForce('Yoda');
whichSideOfTheForce('Palpatine');
whichSideOfTheForce('Anakin');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.