mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-08-28 12:45:42 +00:00
Docs: Update benchmark for google/gemini-3.7-flash EFF:high
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export async function processCSV(csvString, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) {
|
||||
const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm');
|
||||
const { data } = parse(csvString, { header: true, skipEmptyLines: true });
|
||||
|
||||
const groups = new Map();
|
||||
|
||||
for (const row of data) {
|
||||
if (row[filterColumn] == filterValue) {
|
||||
const key = row[groupBy];
|
||||
const val = +row[aggregateColumn] || 0;
|
||||
const acc = groups.get(key) || { sum: 0, count: 0 };
|
||||
acc.sum += val;
|
||||
acc.count += 1;
|
||||
groups.set(key, acc);
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(groups, ([key, { sum, count }]) => ({
|
||||
[groupBy]: key,
|
||||
result: operation === 'count' ? count : operation === 'avg' ? sum / count : sum
|
||||
}));
|
||||
}
|
||||
export default processCSV;
|
||||
// Generation time: 12.695s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user