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