Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String parse
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/118.0.0.0 Safari/537.36
Browser:
Chrome 118
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
modelCheck
3582662.8 Ops/sec
modelCheckOrig
1491317.2 Ops/sec
Script Preparation code:
function modelCheckOrig(target, ...args) { const rgx = /[-_.]/g; const processedArgs = []; while (args.length) { const item = args.pop(); if (Array.isArray(item)) for (const x of item) args.push(x); else processedArgs.push(item.replace(rgx, '[-_.]*')); } return new RegExp(`\\b(?:${processedArgs.join('|')})\\b`, 'g').test(target); } const modelCheckCache = new Map(); function modelCheck(target, ...args) { const cacheKey = args.toString(); let pattern = modelCheckCache.get(cacheKey); if (!pattern) { let list; while (args.length) { const item = args.pop(); if (Array.isArray(item)) for (const x of item) args.push(x); else list += !list ? item : `|${item}`; } pattern = new RegExp(`\\b(?:${list.replace(/[_.-]+/g, '[_.-]*')})\\b`); modelCheckCache.set(cacheKey, pattern); } return pattern.test(target); } const modelStrTestCACHE = new Map(); function modelStrTest(target, ...args) { const cacheKey = args.toString(); let pattern = modelStrTestCACHE.get(cacheKey); if (!pattern) { let list = ''; while (args.length) { const item = args.pop(); if (Array.isArray(item)) for (const x of item) args.push(x); else list += list === '' ? item : `|${item}`; } pattern = new RegExp(`\\b(?:${list.replace(/[_.-]+/g, '[_.-]*')})\\b`); modelStrTestCACHE.set(cacheKey, pattern); } return pattern.test(target); }
Tests:
modelCheck
modelCheck('gpt-4o', 'o1', 'o3', '4o');
modelStrTest
modelStrTest('gpt-4o', 'o1', 'o3', '4o');