1 line
722 B
JavaScript
1 line
722 B
JavaScript
async function fcn_benchmarkAjax(e=1,t={},n=null,o={},r="get"){let s=0;console.log(`Starting benchmark with ${e} AJAX requests...`);try{"get"===r?await FcnUtils.aGet(t,n,o):await FcnUtils.aPost(t,n,o)}catch(e){console.error("Error during warm-up request:",e)}for(let c=0;c<e;c++){const e=performance.now();try{"get"===r?await FcnUtils.aGet(t,n,o):await FcnUtils.aPost(t,n,o),s+=performance.now()-e}catch(e){console.error("Error during AJAX request:",e)}}const c=s/e;return console.log(`Finished benchmarking. Average AJAX response time over ${e} requests: ${c.toFixed(2)} ms`),c}function fcn_printAjaxResponse(e,t="get"){"get"===t?FcnUtils.aGet(e).then((e=>{console.log(e)})):FcnUtils.aPost(e).then((e=>{console.log(e)}))} |