mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-07 20:12:13 +00:00
Docs: Update benchmark for anthropic/claude-opus-4.8 EFF:medium
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
const CDN = "https://esm.sh/";
|
||||
|
||||
const hexchain = async (toml) => {
|
||||
const [
|
||||
{ parse },
|
||||
{ default: seedrandom },
|
||||
ss,
|
||||
{ default: Ajv },
|
||||
{ default: table },
|
||||
{ default: DOMPurify }
|
||||
] = await Promise.all([
|
||||
import(`${CDN}smol-toml`),
|
||||
import(`${CDN}seedrandom`),
|
||||
import(`${CDN}simple-statistics`),
|
||||
import(`${CDN}ajv`),
|
||||
import(`${CDN}text-table`),
|
||||
import(`${CDN}dompurify`)
|
||||
]);
|
||||
|
||||
const config = parse(toml);
|
||||
|
||||
const schema = {
|
||||
type: "object",
|
||||
required: ["seed", "count", "label"],
|
||||
properties: {
|
||||
seed: { type: "string" },
|
||||
count: { type: "integer", minimum: 1, maximum: 10000 },
|
||||
label: { type: "string", minLength: 1 }
|
||||
}
|
||||
};
|
||||
|
||||
const ajv = new Ajv();
|
||||
if (!ajv.validate(schema, config))
|
||||
return { valid: false, errors: ajv.errorsText() };
|
||||
|
||||
const rng = new seedrandom(config.seed);
|
||||
const nums = Array.from({ length: config.count }, () => rng());
|
||||
|
||||
const r = (n) => Math.round(n * 1e6) / 1e6;
|
||||
const mean = r(ss.mean(nums));
|
||||
const stddev = r(ss.standardDeviation(nums));
|
||||
const median = r(ss.median(nums));
|
||||
|
||||
const tableString = table([
|
||||
["Stat", "Value"],
|
||||
["mean", String(mean)],
|
||||
["stddev", String(stddev)],
|
||||
["median", String(median)]
|
||||
]);
|
||||
|
||||
const sanitized = DOMPurify.sanitize(
|
||||
`<pre class="stats">${tableString}</pre>`
|
||||
);
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
label: config.label,
|
||||
stats: { mean, stddev, median },
|
||||
table: sanitized,
|
||||
count: config.count
|
||||
};
|
||||
};
|
||||
|
||||
export { hexchain };
|
||||
export default hexchain;
|
||||
// Generation time: 8.247s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user