map vs not map (v2)

Revision 2 of this benchmark created on


Setup

const action = {
	type: "[Tasks] Do A Thing"
}

const matchingAction = {
		type: "[Side Panel] One Thing"
	}
	
const anotherAction = {
		type: "[Side Panel] Two Thing"
	}

const sidePanelActions = [
	matchingAction,
	anotherAction
]

const actionSet = new Set([matchingAction.type, anotherAction.type]);

Test runner

Ready to run.

Testing in
TestOps/sec
includes
action.type.includes("[Side Panel]");
ready
map
sidePanelActions.map(action => action.type).includes(action.type);
ready
set (no match)
actionSet.has(action.type)
ready
set (match)
actionSet.has(matchingAction.type)
ready
includes (match)
matchingAction.type.includes("[Side Panel]")
ready
map (match)
sidePanelActions.map(action => action.type).includes(matchingAction.type);
ready

Revisions

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