mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark for google/gemini-3-flash-preview TEMP:0.35
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
export const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => {
|
||||
const [{ default: Papa }, { default: _ }] = await Promise.all([
|
||||
import('https://cdn.skypack.dev/papaparse'),
|
||||
import('https://cdn.skypack.dev/lodash')
|
||||
]);
|
||||
|
||||
const { data } = Papa.parse(csv, {
|
||||
header: true,
|
||||
skipEmptyLines: 'greedy'
|
||||
});
|
||||
|
||||
return _.chain(data)
|
||||
.filter(row => row[filterColumn] == filterValue)
|
||||
.groupBy(groupBy)
|
||||
.map((groupRows, groupKey) => {
|
||||
const numbers = groupRows.map(r => Number(r[aggregateColumn]) || 0);
|
||||
const sum = _.sum(numbers);
|
||||
const result = {
|
||||
sum,
|
||||
avg: sum / numbers.length,
|
||||
count: numbers.length
|
||||
}[operation];
|
||||
|
||||
return {
|
||||
[groupBy]: groupKey,
|
||||
result
|
||||
};
|
||||
})
|
||||
.value();
|
||||
};
|
||||
export default processCSV;
|
||||
// Generation time: 18.916s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user