mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Docs: Update benchmark for test 4
This commit is contained in:
53
tests/4_hexchain_pipeline/outputs/deepseek_deepseek-v3.2.js
Normal file
53
tests/4_hexchain_pipeline/outputs/deepseek_deepseek-v3.2.js
Normal file
@@ -0,0 +1,53 @@
|
||||
async function hexchain(tomlString) {
|
||||
const cdn = 'https://esm.sh/';
|
||||
const toml = await import(cdn + 'smol-toml');
|
||||
const { default: seedrandom } = await import(cdn + 'seedrandom');
|
||||
const ss = await import(cdn + 'simple-statistics');
|
||||
const Ajv = (await import(cdn + 'ajv')).default;
|
||||
const tt = await import(cdn + 'text-table');
|
||||
const DOMPurify = await import(cdn + 'dompurify');
|
||||
|
||||
const config = toml.parse(tomlString);
|
||||
const ajv = new Ajv();
|
||||
const schema = {
|
||||
type: 'object',
|
||||
required: ['seed', 'count', 'label'],
|
||||
properties: {
|
||||
seed: { type: 'string' },
|
||||
count: { type: 'integer', minimum: 1, maximum: 10000 },
|
||||
label: { type: 'string', minLength: 1 }
|
||||
}
|
||||
};
|
||||
|
||||
if (!ajv.validate(schema, config)) {
|
||||
return { valid: false, errors: ajv.errorsText() };
|
||||
}
|
||||
|
||||
const rng = seedrandom(config.seed);
|
||||
const numbers = Array.from({ length: config.count }, () => rng());
|
||||
const mean = parseFloat(ss.mean(numbers).toFixed(6));
|
||||
const stddev = parseFloat(ss.standardDeviation(numbers).toFixed(6));
|
||||
const median = parseFloat(ss.median(numbers).toFixed(6));
|
||||
|
||||
const tableArray = [
|
||||
['Stat', 'Value'],
|
||||
['mean', mean.toString()],
|
||||
['stddev', stddev.toString()],
|
||||
['median', median.toString()]
|
||||
];
|
||||
|
||||
const tableString = tt.default(tableArray);
|
||||
const html = `<pre class="stats">${tableString}</pre>`;
|
||||
const sanitizedHTML = DOMPurify.sanitize(html);
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
label: config.label,
|
||||
stats: { mean, stddev, median },
|
||||
table: sanitizedHTML,
|
||||
count: config.count
|
||||
};
|
||||
}
|
||||
export default hexchain;
|
||||
// Generation time: 15.489s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user