jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
const Old = (a, p, i) => {
let c = a
, o = 0
, h = 0;
for (; c > 0; ) {
let P = parseFloat(p) / 100 / 12 * parseFloat(c);
if (P > parseFloat(i))
return {
paymentTooLow: !0
};
let g = parseFloat(i) - parseFloat(P);
c = parseFloat(c) - parseFloat(g),
h += P,
o++
}
}
function New(
principal,
interest,
monthly
) {
let monthlyInterestRate = interest / 12;
let totalMonthlyPayment = monthly;
let months =
Math.log(
totalMonthlyPayment /
(totalMonthlyPayment - monthlyInterestRate * principal)
) / Math.log(1 + monthlyInterestRate);
let totalPayments = months * totalMonthlyPayment;
let totalInterest = totalPayments - principal;
return {
months,
totalInterest,
};
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Old |
| ready |
New |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.