mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-28 04:12:13 +00:00
Docs: Update benchmark for anthropic/claude-fable-5
This commit is contained in:
23
tests/6_csv_processor/outputs/anthropic_claude-fable-5.js
Normal file
23
tests/6_csv_processor/outputs/anthropic_claude-fable-5.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => {
|
||||
const { default: Papa } = await import('https://esm.sh/papaparse@5.4.1');
|
||||
const { data } = Papa.parse(csv.trim(), { header: true, skipEmptyLines: true });
|
||||
const groups = new Map();
|
||||
|
||||
for (const row of data) {
|
||||
if (row[filterColumn] != filterValue) continue;
|
||||
const key = row[groupBy];
|
||||
const val = +row[aggregateColumn] || 0;
|
||||
const g = groups.get(key) ?? { sum: 0, count: 0 };
|
||||
g.sum += val;
|
||||
g.count++;
|
||||
groups.set(key, g);
|
||||
}
|
||||
|
||||
return [...groups].map(([key, { sum, count }]) => ({
|
||||
[groupBy]: key,
|
||||
result: operation === 'sum' ? sum : operation === 'avg' ? sum / count : count
|
||||
}));
|
||||
};
|
||||
export default processCSV;
|
||||
// Generation time: 14.656s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user