[{"data":1,"prerenderedAt":185},["ShallowReactive",2],{"term-b\u002Fbenchmarking":3,"related-b\u002Fbenchmarking":168},{"id":4,"title":5,"acronym":6,"body":7,"category":149,"description":150,"difficulty":151,"extension":152,"letter":153,"meta":154,"navigation":155,"path":156,"related":157,"seo":162,"sitemap":163,"stem":166,"subcategory":6,"__hash__":167},"terms\u002Fterms\u002Fb\u002Fbenchmarking.md","Benchmarking",null,{"type":8,"value":9,"toc":143},"minimark",[10,15,19,23,26,30,132,136,139],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"Benchmarking is timing your code to prove it's actually fast, and it is shockingly easy to do wrong. Run something once and you're measuring a cold cache and a confused JIT compiler, not real performance. Real benchmarks warm up first, run many iterations, and report a distribution instead of one lucky number, because a single it ran in 2ms is basically a rumor.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Benchmarking is the disciplined measurement of code performance under controlled, repeatable conditions. Reliable microbenchmarks account for JIT warmup, garbage collection pauses, and CPU frequency scaling, and report statistical distributions like median and percentiles rather than a single run, since a single measurement is dominated by noise and can even be skewed by dead code elimination in the compiler.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F A naive benchmark lies: no warmup, one run, result never used\nconst start = performance.now();\nconst result = expensiveFn();\nconsole.log(performance.now() - start);\n\u002F\u002F A real benchmark: warm up, run N times, report percentiles\n","javascript","",[38,39,40,49,80,97,126],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F A naive benchmark lies: no warmup, one run, result never used\n",[41,50,52,56,60,64,67,70,74,77],{"class":43,"line":51},2,[41,53,55],{"class":54},"spNyl","const",[41,57,59],{"class":58},"sTEyZ"," start ",[41,61,63],{"class":62},"sMK4o","=",[41,65,66],{"class":58}," performance",[41,68,69],{"class":62},".",[41,71,73],{"class":72},"s2Zo4","now",[41,75,76],{"class":58},"()",[41,78,79],{"class":62},";\n",[41,81,83,85,88,90,93,95],{"class":43,"line":82},3,[41,84,55],{"class":54},[41,86,87],{"class":58}," result ",[41,89,63],{"class":62},[41,91,92],{"class":72}," expensiveFn",[41,94,76],{"class":58},[41,96,79],{"class":62},[41,98,100,103,105,108,111,113,115,118,121,124],{"class":43,"line":99},4,[41,101,102],{"class":58},"console",[41,104,69],{"class":62},[41,106,107],{"class":72},"log",[41,109,110],{"class":58},"(performance",[41,112,69],{"class":62},[41,114,73],{"class":72},[41,116,117],{"class":58},"() ",[41,119,120],{"class":62},"-",[41,122,123],{"class":58}," start)",[41,125,79],{"class":62},[41,127,129],{"class":43,"line":128},5,[41,130,131],{"class":47},"\u002F\u002F A real benchmark: warm up, run N times, report percentiles\n",[11,133,135],{"id":134},"when-youll-hear-this","When You'll Hear This",[16,137,138],{},"\"That benchmark result is meaningless, you ran it once with a cold JIT.\" \u002F \"We benchmark with a proper warmup phase now after getting burned by fake numbers.\"",[140,141,142],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":144},[145,146,147,148],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":134,"depth":51,"text":135},"backend","Benchmarking is timing your code to prove it's actually fast, and it is shockingly easy to do wrong.","intermediate","md","b",{},true,"\u002Fterms\u002Fb\u002Fbenchmarking",[158,159,160,161],"Profiling","JIT Warmup","Latency","Flame Graph",{"title":5,"description":150},{"changefreq":164,"priority":165},"weekly",0.7,"terms\u002Fb\u002Fbenchmarking","eV1qwYZGvgpY08-XI5lqVR798HWDhIqYvMbJqQZTlRI",[169,172,177,182],{"title":161,"path":170,"acronym":6,"category":149,"difficulty":151,"description":171},"\u002Fterms\u002Ff\u002Fflame-graph","A flame graph is a picture of where your program actually spent its time, and it looks like a skyline made of stacked flames.",{"title":159,"path":173,"acronym":6,"category":174,"difficulty":175,"description":176},"\u002Fterms\u002Fj\u002Fjit-warmup","languages","advanced","A JIT compiler starts out running your code the slow, simple way, an interpreter, while it quietly watches which parts get called the most.",{"title":160,"path":178,"acronym":6,"category":179,"difficulty":180,"description":181},"\u002Fterms\u002Fl\u002Flatency","networking","beginner","Latency is the delay before data starts moving — the time it takes for a request to go from your device to the server and back.",{"title":158,"path":183,"acronym":6,"category":149,"difficulty":151,"description":184},"\u002Fterms\u002Fp\u002Fprofiling","Profiling is watching your program run and keeping score of where the time and memory actually go, instead of guessing.",1792528065191]