mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-05-18 04:32:12 +00:00
Docs: Update benchmark for google/gemini-3.1-flash-lite
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
async function processCSV(csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) {
|
||||
const { parse } = await import('https://cdn.skypack.dev/papaparse');
|
||||
const { data } = parse(csv, { header: true, dynamicTyping: true });
|
||||
|
||||
const groups = data
|
||||
.filter(r => r[filterColumn] == filterValue)
|
||||
.reduce((acc, r) => {
|
||||
const key = r[groupBy];
|
||||
const val = Number(r[aggregateColumn]) || 0;
|
||||
acc[key] ??= { sum: 0, count: 0 };
|
||||
acc[key].sum += val;
|
||||
acc[key].count += 1;
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return Object.entries(groups).map(([k, v]) => ({
|
||||
[groupBy]: k,
|
||||
result: operation === 'sum' ? v.sum :
|
||||
operation === 'avg' ? v.sum / v.count : v.count
|
||||
}));
|
||||
}
|
||||
export default processCSV;
|
||||
// Generation time: 1.360s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user