Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Grad AC
(version: 0)
Comparing performance of:
Kyle vs Alicia vs James A vs Yichao vs Keanu
Created:
3 years ago
by:
Guest
Jump to the latest result
Tests:
Kyle
function solution(A, D) { // combine arrays (removing day for grouping by YYYY-MM) const combined = A.map((num, i) => ({ num, date: D[i].substring(0, 7) })) const groupedByDate = combined.reduce((r, a) => { r[a.date] = r[a.date] || []; r[a.date].push(a); return r; }, Object.create(null)); let total = 0; let monthsVoid = 0; Object.keys(groupedByDate).forEach(date => { const arr = groupedByDate[date]; const expenditures = arr.filter(d => d.num < 0); const expendituresTotal = expenditures.reduce((p, c) => p + c.num, 0); const incomings = arr.filter(d => d.num >= 0); const incomingsTotal = incomings.reduce((p, c) => p + c.num, 0); if (expenditures.length >= 3 && expendituresTotal <= -100) { monthsVoid += 1; } total += expendituresTotal + incomingsTotal; }); const result = total - ((12 - monthsVoid) * 5); return result; }
Alicia
function solution(A, D) { const balanceBeforeFees = A.reduce((acc, val) => { return acc+val; }, 0); const transactions = A.map((ammount, i) => ({ ammount, date: D[i].split('-')[1] })) const transactionPerDate = transactions.reduce((acc, val) => { acc[val.date] = acc[val.date] || []; acc[val.date].push(val); return acc; }, {}); let fees = (12 - Object.keys(transactionPerDate).length) * 5; Object.keys(transactionPerDate).forEach(date => { const arr = transactionPerDate[date]; const payments = arr.filter(el => el.ammount < 0); const paymentsTotal = payments.reduce((acc, val) => acc + val.ammount, 0); if ((payments.length < 3 || paymentsTotal > -100) || (payments.length < 3 && paymentsTotal > -100) ) { fees += 5 } }); return balanceBeforeFees - fees; }
James A
function solution(A, D) { const txsPerMonth = { 01: [], 02: [], 03: [], 04: [], 05: [], 06: [], 07: [], 08: [], 09: [], 10: [], 11: [], 12: [], }; D.forEach((date, idx) => { txsPerMonth[parseInt(date.split('-')[1], 10)].push(A[idx]); }) let finalTotal = 0; Object.values(txsPerMonth).forEach((arr) => { let totalTxsOut = 0; let totalValueOut = 0; let total = arr.reduce((acc, curr) => { if (curr < 0) { totalTxsOut++; totalValueOut -= curr; } return acc + curr; }, 0); if (totalTxsOut < 3 || totalValueOut < 100) { total -= 5; } finalTotal += total; }); return finalTotal; }
Yichao
function solution(A, D) { // A is array of transaction amounts, D is array of transaction date. // calculate sum of elements in A const sum = A.reduce((a, b) => a + b, 0); // calculate how many months there are in D const DateArray = D.map(date => date.split('-')); let monthArray = []; for (let i = 0; i < DateArray.length; i++) { monthArray.push(DateArray[i][1]); } const negTransac = A.filter(amount => amount < 0); let condition2; if ( negTransac.length >= 3) { abValue = negTransac.reduce((a, b) => a + b) * -1; if (abValue >= 100) { condition2 = true; } else { condition2 = false; } } let monthFinal = (monthArray.includes("01")) || (condition2) ? 11 : 12; const totalSum = sum - (5 * monthFinal); return totalSum; }
Keanu
function solution(A, D) { // Implement your solution here let total = 0; let months = new Array(12); for(let i = 0; i < 12; i ++) { months[i] = new Array(); } for(let i = 0; i < A.length; i ++) { let month = D[i].substring(5,7); month = parseInt(month); months[month -1].push(A[i]); } for(let i = 0; i < 12; i ++) { let noPaidTrasnactions = 0; let monthlyTotal = 0; let transactions = months[i]; for(let j = 0; j < transactions.length; j ++) { let transaction = transactions[j]; if(transaction < 0) { noPaidTrasnactions ++; monthlyTotal += (transaction * -1) } total += transaction; } if(noPaidTrasnactions < 3 || monthlyTotal < 100) { total -= 5 } } return total; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
Kyle
Alicia
James A
Yichao
Keanu
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It seems like you're comparing two different JavaScript benchmarks. Based on the raw benchmark data, I can see that the most recent result has an average of 6,048,311,520 executions per second (ExecutionsPerSecond) for the test "James A". However, to give a more meaningful comparison, I would need to know what the expected value is and how the benchmarks are supposed to be normalized.
Related benchmarks:
sdfasdfasdf
reduce me test 000009
Lodash orderBy vs array.prototype.sort string
7894549846549843546846549844
15614984163549849849849848948564
Comments
Confirm delete:
Do you really want to delete benchmark?