Ignoring props

Benchmark created on


Setup

const filterPropsToIgnore = new Set(['offset', 'orderBy', 'inactive', 'limit']);
function ignoreFilterProperty1(key) {
  return filterPropsToIgnore.has(key);
}

function ignoreFilterProperty2(key) {
  return key === 'offset' || key === 'orderBy' || key === 'inactive' || key === 'limit';
}

Test runner

Ready to run.

Testing in
TestOps/sec
Using Set
for(let i = 0; i < 100000; i++) {
	ignoreFilterProperty1('limit');
	ignoreFilterProperty1('test');
}
ready
Using bool operators
for(let i = 0; i < 100000; i++) {
	ignoreFilterProperty2('limit');
	ignoreFilterProperty2('test');
}
ready

Revisions

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