Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
getRelevantPositions
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Stara opcja
1626.7 Ops/sec
Nowa opcja
1976.8 Ops/sec
Tests:
Stara opcja
const IRRELEVANT_PARAGRAPHS = [ '401', '402', '404', '405', '406', '407', '408', '409', '410', '411', '412', '417', '418', '471', '474', '475', '478', '479', '480', '483', '484', '485', '801', '804', '806', '807', '808', '809', '810', '811', '812', '813', '814', '605', '606', '610', '613', '615', '617', '619', '620', '621', '622', '623', '625', '630', '637', '647', '648', '649', '656', '657', '658', '659', '661', '662', '663', '664', '665', '666', '669', '672', '680', ]; const IRRELEVANT_GROUPS = ['1400', '1810', '1600', '1601', '1602', '1610', '1611', '1612']; const positions = []; const classificationDetailLevels = ['paragraph', 'systemGroup', 'ordinanceGroup']; for (let i = 0; i < 1000; i++) { const randomIndex = Math.floor(Math.random() * classificationDetailLevels.length); positions.push({ paragraph: `Paragraph ${Math.floor(Math.random() * 10)}`, group: `Group ${Math.floor(Math.random() * 5)}`, }); } const getRelevantPositions = (outgoings, classificationDetailLevel) => outgoings.filter((position) => { switch (classificationDetailLevel) { case 'paragraph': return position.paragraph && !IRRELEVANT_PARAGRAPHS.includes(position.paragraph); case 'systemGroup': case 'ordinanceGroup': return position.group && !IRRELEVANT_GROUPS.includes(position.group); default: return false; } }); classificationDetailLevels.forEach((classificationDetailLevel) => getRelevantPositions(positions, classificationDetailLevel))
Nowa opcja
const IRRELEVANT_PARAGRAPHS = [ '401', '402', '404', '405', '406', '407', '408', '409', '410', '411', '412', '417', '418', '471', '474', '475', '478', '479', '480', '483', '484', '485', '801', '804', '806', '807', '808', '809', '810', '811', '812', '813', '814', '605', '606', '610', '613', '615', '617', '619', '620', '621', '622', '623', '625', '630', '637', '647', '648', '649', '656', '657', '658', '659', '661', '662', '663', '664', '665', '666', '669', '672', '680', ]; const IRRELEVANT_GROUPS = ['1400', '1810', '1600', '1601', '1602', '1610', '1611', '1612']; const positions = []; const classificationDetailLevels = ['paragraph', 'systemGroup', 'ordinanceGroup']; for (let i = 0; i < 1000; i++) { const randomIndex = Math.floor(Math.random() * classificationDetailLevels.length); positions.push({ paragraph: `Paragraph ${Math.floor(Math.random() * 10)}`, group: `Group ${Math.floor(Math.random() * 5)}`, }); } const getRelevantPositions = ({ outgoings, classificationDetailLevel }) => { let condition; switch (classificationDetailLevel) { case 'paragraph': condition = (position) => position.paragraph && !IRRELEVANT_PARAGRAPHS.includes(position.paragraph); break; case 'systemGroup': case 'ordinanceGroup': condition = (position) => position.group && !IRRELEVANT_GROUPS.includes(position.group); break; return outgoings.filter(contidion) } } classificationDetailLevels.forEach((classificationDetailLevel) => getRelevantPositions(positions, classificationDetailLevel))