[{"data":1,"prerenderedAt":704},["ShallowReactive",2],{"doc:\u002Fbenchmarks\u002Fcomparison":3,"nav:guides":651},{"doc":4,"source":650},{"id":5,"title":6,"body":7,"description":642,"extension":643,"meta":644,"navigation":645,"path":646,"seo":647,"stem":648,"__hash__":649},"benchmarks\u002Fbenchmarks\u002Fcomparison.md","Same-run comparison with pkl-zig",{"type":8,"value":9,"toc":635},"minimark",[10,14,39,55,60,129,136,140,146,270,318,390,393,397,407,488,532,536,539,542,631],[11,12,6],"h1",{"id":13},"same-run-comparison-with-pkl-zig",[15,16,17,21,22,29,30,33,34,38],"p",{},[18,19,20],"code",{},"bench\u002Fcompare.sh"," builds zig-pkl with Zig 0.17.0 and ",[23,24,28],"a",{"href":25,"rel":26},"https:\u002F\u002Fgithub.com\u002Fburakssen\u002Fpkl-zig",[27],"nofollow","pkl-zig"," ",[18,31,32],{},"6a113ab"," with Zig 0.16.0, runs both against the same Pkl executable, and applies the release gates in ",[23,35,37],{"href":36},"baseline","baseline.md",". pkl-zig is used only through its public API.",[40,41,46],"pre",{"className":42,"code":43,"language":44,"meta":45,"style":45},"language-sh shiki shiki-themes github-light github-dark","ZIG_0_16=\u002Fpath\u002Fto\u002Fzig-0.16.0\u002Fzig PKL_EXEC=\u002Fpath\u002Fto\u002Fpkl bench\u002Fcompare.sh 21\n","sh","",[18,47,48],{"__ignoreMap":45},[49,50,53],"span",{"class":51,"line":52},"line",1,[49,54,43],{},[56,57,59],"h2",{"id":58},"method","Method",[61,62,63,79,97,100,111,114],"ul",{},[64,65,66,67,70,71,74,75,78],"li",{},"Both programs, ",[18,68,69],{},"bench\u002Fzig-pkl.zig"," and ",[18,72,73],{},"bench\u002Fpkl-zig\u002Fsrc\u002Fmain.zig",", run the same cases with the same iteration counts, backing allocator (",[18,76,77],{},"std.heap.smp_allocator","), timer, and output format.",[64,80,81,82,85,86,70,89,92,93,96],{},"Codec cases decode the pkl-binary fixtures in ",[18,83,84],{},"bench\u002Ffixtures"," 2000 times after 200 unmeasured decodes. ",[18,87,88],{},"decode_config",[18,90,91],{},"decode_mixed"," build each library's dynamic value tree; ",[18,94,95],{},"typed_config"," decodes into the same Zig structs and frees them.",[64,98,99],{},"Allocations count calls that reach the backing allocator, so each arena chunk counts once.",[64,101,102,103,106,107,110],{},"The cold case starts ",[18,104,105],{},"pkl server",", creates an evaluator, evaluates ",[18,108,109],{},"(1 + 2) * 14",", and shuts down, 10 times per round after one unmeasured cycle. Each round reports the median cycle and the median of each phase. The warm case evaluates the same expression 200 times on a running evaluator after 20 unmeasured evaluations.",[64,112,113],{},"Each library runs once unrecorded, then the rounds alternate which library goes first. Reported figures are medians over the rounds.",[64,115,116,117,120,121,124,125,128],{},"The fixtures are evaluated through ",[18,118,119],{},"modulepath:"," URIs, so their bytes do not depend on the checkout path. ",[18,122,123],{},"bench\u002Ffixtures\u002F*.pkl"," regenerate them with ",[18,126,127],{},"pkl eval --module-path bench\u002Ffixtures -f pkl-binary -o bench\u002Ffixtures\u002F\u003Cname>.pklbin modulepath:\u002F\u003Cname>.pkl",".",[15,130,131,132,135],{},"CI runs the comparison on Linux x86_64 in the ",[18,133,134],{},"bench"," job, writes the summary to the job page, and uploads the raw results.",[56,137,139],{"id":138},"results-on-macos-arm64","Results on macOS arm64",[15,141,142,143,128],{},"Apple M5, Pkl 0.32.2 native, 31 rounds. Raw data: ",[23,144,145],{"href":145},"results\u002Fmacos-arm64",[147,148,149,174],"table",{},[150,151,152],"thead",{},[153,154,155,159,162,165,168,171],"tr",{},[156,157,158],"th",{},"Case",[156,160,28],{"align":161},"right",[156,163,164],{"align":161},"zig-pkl",[156,166,167],{"align":161},"Speedup",[156,169,170],{"align":161},"pkl-zig allocations",[156,172,173],{"align":161},"zig-pkl allocations",[175,176,177,197,215,234,252],"tbody",{},[153,178,179,182,185,188,191,194],{},[180,181,88],"td",{},[180,183,184],{"align":161},"206.7 MiB\u002Fs",[180,186,187],{"align":161},"669.7 MiB\u002Fs",[180,189,190],{"align":161},"3.24x",[180,192,193],{"align":161},"1962",[180,195,196],{"align":161},"8",[153,198,199,201,204,207,210,213],{},[180,200,91],{},[180,202,203],{"align":161},"241.0 MiB\u002Fs",[180,205,206],{"align":161},"554.2 MiB\u002Fs",[180,208,209],{"align":161},"2.30x",[180,211,212],{"align":161},"1821",[180,214,196],{"align":161},[153,216,217,219,222,225,228,231],{},[180,218,95],{},[180,220,221],{"align":161},"190.3 MiB\u002Fs",[180,223,224],{"align":161},"531.3 MiB\u002Fs",[180,226,227],{"align":161},"2.79x",[180,229,230],{"align":161},"2284",[180,232,233],{"align":161},"330",[153,235,236,239,242,245,248,250],{},[180,237,238],{},"cold evaluator",[180,240,241],{"align":161},"8.41 ms",[180,243,244],{"align":161},"7.76 ms",[180,246,247],{"align":161},"1.08x",[180,249],{"align":161},[180,251],{"align":161},[153,253,254,257,260,263,266,268],{},[180,255,256],{},"warm evaluate",[180,258,259],{"align":161},"31.42 µs",[180,261,262],{"align":161},"25.48 µs",[180,264,265],{"align":161},"1.23x",[180,267],{"align":161},[180,269],{"align":161},[147,271,272,283],{},[150,273,274],{},[153,275,276,279,281],{},[156,277,278],{},"Cold phase",[156,280,28],{"align":161},[156,282,164],{"align":161},[175,284,285,296,307],{},[153,286,287,290,293],{},[180,288,289],{},"start and create evaluator",[180,291,292],{"align":161},"7.34 ms",[180,294,295],{"align":161},"6.64 ms",[153,297,298,301,304],{},[180,299,300],{},"evaluate",[180,302,303],{"align":161},"0.38 ms",[180,305,306],{"align":161},"0.35 ms",[153,308,309,312,315],{},[180,310,311],{},"close and shut down",[180,313,314],{"align":161},"0.76 ms",[180,316,317],{"align":161},"0.80 ms",[147,319,320,336],{},[150,321,322],{},[153,323,324,327,330,333],{},[156,325,326],{},"Gate",[156,328,329],{},"Requirement",[156,331,332],{},"Result",[156,334,335],{},"Verdict",[175,337,338,352,365,378],{},[153,339,340,343,346,349],{},[180,341,342],{},"Codec speed",[180,344,345],{},"geometric mean at least 1.25x",[180,347,348],{},"2.75x",[180,350,351],{},"pass",[153,353,354,357,360,363],{},[180,355,356],{},"Allocations",[180,358,359],{},"at least 25% fewer in every codec case",[180,361,362],{},"86% to 99.6% fewer",[180,364,351],{},[153,366,367,370,373,376],{},[180,368,369],{},"Cold evaluator",[180,371,372],{},"at most 5% slower",[180,374,375],{},"7.7% faster",[180,377,351],{},[153,379,380,383,385,388],{},[180,381,382],{},"Warm evaluate",[180,384,372],{},[180,386,387],{},"18.9% faster",[180,389,351],{},[15,391,392],{},"Codec throughput on a laptop varies by about 20% between runs; the ratios are measured in the same run.",[56,394,396],{"id":395},"results-on-linux-x86_64","Results on Linux x86_64",[15,398,399,400,403,404,406],{},"GitHub-hosted ",[18,401,402],{},"ubuntu-24.04"," runner with 2 vCPUs, Pkl 0.32.2 native, 15 rounds, from the CI ",[18,405,134],{}," job. Each CI run publishes its own summary and raw data.",[147,408,409,421],{},[150,410,411],{},[153,412,413,415,417,419],{},[156,414,158],{},[156,416,28],{"align":161},[156,418,164],{"align":161},[156,420,167],{"align":161},[175,422,423,436,449,462,475],{},[153,424,425,427,430,433],{},[180,426,88],{},[180,428,429],{"align":161},"110.7 MiB\u002Fs",[180,431,432],{"align":161},"263.0 MiB\u002Fs",[180,434,435],{"align":161},"2.38x",[153,437,438,440,443,446],{},[180,439,91],{},[180,441,442],{"align":161},"122.8 MiB\u002Fs",[180,444,445],{"align":161},"215.2 MiB\u002Fs",[180,447,448],{"align":161},"1.75x",[153,450,451,453,456,459],{},[180,452,95],{},[180,454,455],{"align":161},"102.4 MiB\u002Fs",[180,457,458],{"align":161},"217.8 MiB\u002Fs",[180,460,461],{"align":161},"2.13x",[153,463,464,466,469,472],{},[180,465,238],{},[180,467,468],{"align":161},"7.67 ms",[180,470,471],{"align":161},"7.66 ms",[180,473,474],{"align":161},"1.00x",[153,476,477,479,482,485],{},[180,478,256],{},[180,480,481],{"align":161},"109.18 µs",[180,483,484],{"align":161},"91.17 µs",[180,486,487],{"align":161},"1.20x",[147,489,490,500],{},[150,491,492],{},[153,493,494,496,498],{},[156,495,278],{},[156,497,28],{"align":161},[156,499,164],{"align":161},[175,501,502,512,522],{},[153,503,504,506,509],{},[180,505,289],{},[180,507,508],{"align":161},"5.27 ms",[180,510,511],{"align":161},"5.28 ms",[153,513,514,516,519],{},[180,515,300],{},[180,517,518],{"align":161},"0.50 ms",[180,520,521],{"align":161},"0.48 ms",[153,523,524,526,529],{},[180,525,311],{},[180,527,528],{"align":161},"1.79 ms",[180,530,531],{"align":161},"1.88 ms",[56,533,535],{"id":534},"cold-start","Cold start",[15,537,538],{},"The cold case is bounded by work inside Pkl that both libraries pay: starting the server and, after stdin closes, the server's own exit, which takes about 2.1 ms on the Linux runner. The remaining shutdown difference on Linux is the thread that keeps the tail of the server's stderr for error reports; pkl-zig does not capture stderr.",[15,540,541],{},"Measured choices, on the Linux runner unless noted:",[147,543,544,554],{},[150,545,546],{},[153,547,548,551],{},[156,549,550],{},"Choice",[156,552,553],{},"Effect on the cold case",[175,555,556,571,581,591,599,607,615,623],{},[153,557,558,565],{},[180,559,560,561,564],{},"Run ",[18,562,563],{},"pkl --version"," before starting the server, as pkl-go does",[180,566,567,568,570],{},"adds a full ",[18,569,563],{},", about 5.8 ms on macOS",[153,572,573,578],{},[180,574,560,575,577],{},[18,576,563],{}," while the server starts",[180,579,580],{},"17% slower than pkl-zig: the second Pkl process competes with the server",[153,582,583,588],{},[180,584,560,585,587],{},[18,586,563],{}," only for options that need a release newer than 0.25.3",[180,589,590],{},"no cost for other options",[153,592,593,596],{},[180,594,595],{},"Start all reader workers with the manager",[180,597,598],{},"about 0.18 ms per thread at start and 0.25 ms to join them at shutdown",[153,600,601,604],{},[180,602,603],{},"Start reader workers when callbacks arrive",[180,605,606],{},"no cost without module or resource readers",[153,608,609,612],{},[180,610,611],{},"Poll for server exit every 100 µs",[180,613,614],{},"wakes up to 100 µs late; shutdown about 0.1 ms slower on macOS, no measurable difference on Linux",[153,616,617,620],{},[180,618,619],{},"Wait on a pidfd (Linux) or kqueue (macOS)",[180,621,622],{},"wakes when the server exits; polling remains the fallback",[153,624,625,628],{},[180,626,627],{},"Kill the server instead of waiting for it to exit",[180,629,630],{},"about 0.6 ms faster on macOS, but external readers and loggers lose their close notification; rejected",[632,633,634],"style",{},"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":45,"searchDepth":636,"depth":636,"links":637},2,[638,639,640,641],{"id":58,"depth":636,"text":59},{"id":138,"depth":636,"text":139},{"id":395,"depth":636,"text":396},{"id":534,"depth":636,"text":535},"bench\u002Fcompare.sh builds zig-pkl with Zig 0.17.0 and pkl-zig 6a113ab with Zig 0.16.0, runs both against the same Pkl executable, and applies the release gates in baseline.md. pkl-zig is used only through its public API.","md",{},true,"\u002Fbenchmarks\u002Fcomparison",{"title":6,"description":642},"benchmarks\u002Fcomparison","BIKDXEQxfgbZGfxVSSilahSkzay69ecMoxWI8SaLtOs","docs\u002Fbenchmarks\u002Fcomparison.md",[652,656,660,664,668,672,676,680,684,688,692,696,700],{"title":653,"path":654,"stem":655},"Version compatibility","\u002Fguides\u002Fcompatibility","guides\u002Fcompatibility",{"title":657,"path":658,"stem":659},"Concurrency","\u002Fguides\u002Fconcurrency","guides\u002Fconcurrency",{"title":661,"path":662,"stem":663},"Errors","\u002Fguides\u002Ferrors","guides\u002Ferrors",{"title":665,"path":666,"stem":667},"Evaluation","\u002Fguides\u002Fevaluation","guides\u002Fevaluation",{"title":669,"path":670,"stem":671},"External readers","\u002Fguides\u002Fexternal-readers","guides\u002Fexternal-readers",{"title":673,"path":674,"stem":675},"Installation","\u002Fguides\u002Finstallation","guides\u002Finstallation",{"title":677,"path":678,"stem":679},"Logging","\u002Fguides\u002Flogging","guides\u002Flogging",{"title":681,"path":682,"stem":683},"Migrating from pkl-zig","\u002Fguides\u002Fmigration","guides\u002Fmigration",{"title":685,"path":686,"stem":687},"Ownership","\u002Fguides\u002Fownership","guides\u002Fownership",{"title":689,"path":690,"stem":691},"Projects","\u002Fguides\u002Fprojects","guides\u002Fprojects",{"title":693,"path":694,"stem":695},"Quick start","\u002Fguides\u002Fquickstart","guides\u002Fquickstart",{"title":697,"path":698,"stem":699},"Readers","\u002Fguides\u002Freaders","guides\u002Freaders",{"title":701,"path":702,"stem":703},"Security","\u002Fguides\u002Fsecurity","guides\u002Fsecurity",1792908673090]