From 82aa65df97332fd2157c4da2b704ef7c6dc4ced1 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Thu, 27 Nov 2025 10:24:02 -0800 Subject: [PATCH] Feat: Append generation time to output file, store 1 in results --- scripts/run-benchmark.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/run-benchmark.js b/scripts/run-benchmark.js index 9591135..46645b9 100644 --- a/scripts/run-benchmark.js +++ b/scripts/run-benchmark.js @@ -31,7 +31,8 @@ const getLlmCode = async (prompt, model, funcName, temp) => { const content = await apiCall(prompt, model, temp); const duration = (performance.now() - start) / 1000; const code = content.match(/```(?:javascript|js)?\n([\s\S]+?)\n```/)?.[1].trim() ?? content.trim(); - return { code: `${code.replace(/export\s+default\s+.*$/m, '')}\nexport default ${funcName};`, duration }; + const clean = code.replace(/export\s+default\s+.*$/m, ''); + return { code: `${clean}\nexport default ${funcName};\n// Generation time: ${duration.toFixed(3)}s`, duration }; } catch (e) { console.error(`API Error ${model}: ${e.message}`); return null; } }; @@ -81,7 +82,7 @@ const main = async () => { console.log(`Gen ${dir} for ${mSpec} in ${OUT_DIR_NAME}...`); const res = await getLlmCode(`${shared}\n\n${prompt.trim()}`, model, functionName, temp); - data[mSpec][dir] = res?.duration ?? null; + data[mSpec][dir] = res ? 1 : null; if (!res) continue; const outDir = path.join(TESTS, dir, OUT_DIR_NAME);