Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
determ
(version: 0)
determ
Comparing performance of:
my vs not
Created:
5 years ago
by:
Guest
Jump to the latest result
Tests:
my
function my(m) { if (m.length === 1) return m[0][0]; if (m[0].length === 2) return m[0][0] * m[1][1] - m[1][0] * m[0][1]; let result = 0; const [firstRow, ...rest] = m; for (let i = 0; i < firstRow.length; i++) { let sign = i % 2 ? -1 : 1; const minorMatrix = rest.map((item) => item.filter((_, idx) => idx !== i)); result += sign * (firstRow[i] * my(minorMatrix)); } return result; } const m1 = [[1, 2, 3], [8, 7, 6], [5, 4, 3]] my(m1)
not
function not(m) { if (m.length == 0) return 0; if (m.length == 1) return m[0][0]; if (m.length == 2) return m[0][0] * m[1][1] - m[0][1] * m[1][0]; if (m.length > 2) { return m.reduce((prev, curr, i, arr) => { let miniArr = arr.slice(0, i).concat(arr.slice(i + 1)).map(item => item.slice(1)); return prev + (i % 2 == 0 ? 1 : -1 ) * curr[0] * not(miniArr); }, 0); } }; const m1 = [[1, 2, 3], [8, 7, 6], [5, 4, 3]] not(m1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
my
not
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!
Related benchmarks:
array flatten
Ryan Test Benchmark
Array equivalence
TEST SWAP FUNC
bmm tests2
Comments
Confirm delete:
Do you really want to delete benchmark?