Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-27 19:36:55 +00:00
parent e8b9dd6d0e
commit ba567f4017
109 changed files with 1138 additions and 1679 deletions
@@ -1,12 +1,24 @@
let Ajv;
async function validateJSON(json, schema) {
if(!(json&&typeof json==='object')||!(schema===true||schema===false||(schema&&typeof schema==='object')))
return{valid:false,errors:['Invalid input']};
try{
if(!Ajv){const m=await import('https://esm.sh/ajv@8');Ajv=m.default}
const ajv=new Ajv({allErrors:true}),v=ajv.compile(schema);
const valid=v(json);
return{valid,errors:valid?[]:v.errors.map(e=>`${e.instancePath||'root'} ${e.message}`)};
}catch(e){return{valid:false,errors:[e.message]}}
}
export default validateJSON;
let a, c;
export const validateJSON = async (d, s) => {
try {
if (!a) {
const { default: Ajv } = await import('https://esm.sh/ajv?bundle');
a = new Ajv({ allErrors: true });
c = new Map();
}
const k = JSON.stringify(s);
if (!c.has(k)) c.set(k, a.compile(s));
const v = c.get(k);
const valid = v(d);
return {
valid,
errors: valid ? [] : v.errors.map(e => `${e.instancePath || 'root'} ${e.message}`)
};
} catch (e) {
return { valid: false, errors: [e.message] };
}
};
export default validateJSON;
// Generation time: 19.566s
// Result: PASS