mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Docs: Update benchmark for openrouter/pony-alpha
This commit is contained in:
18
tests/6_csv_processor/outputs/openrouter_pony-alpha.js
Normal file
18
tests/6_csv_processor/outputs/openrouter_pony-alpha.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => {
|
||||
const { default: Papa } = await import('https://esm.run/papaparse')
|
||||
const { data } = Papa.parse(csv, { header: true })
|
||||
const grouped = data.filter(r => r[fc] == fv).reduce((a, r) => {
|
||||
const k = r[gb], v = +r[ac] || 0
|
||||
a[k] = a[k] || { s: 0, c: 0 }
|
||||
a[k].s += v
|
||||
a[k].c++
|
||||
return a
|
||||
}, {})
|
||||
return Object.entries(grouped).map(([k, { s, c }]) => ({
|
||||
[gb]: k,
|
||||
result: op === 'count' ? c : op === 'sum' ? s : s / c
|
||||
}))
|
||||
}
|
||||
export default processCSV;
|
||||
// Generation time: 257.221s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user