Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
test max
(version: 1)
Comparing performance of:
1 vs test2
Created:
one month ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const cars = [ { model:"Alfa Romeo", color:"red", year:2018, price:"$2000" }, { model:"Alfa Romeo", color:"blue", year:2018, price:"$2000" }, { model:"Ford", color:"blue", year:2017, price:"$3000" } ];
Tests:
1
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ function maxPriceCar(cars) { let maxPriceCars = [cars[0]]; for (let i = 1;i<cars.length;i++) { if (cars[i].price>maxPriceCars[0].price) { maxPriceCars = [cars[i]]; } else if (cars[i].price==maxPriceCars[0].price) { maxPriceCars.push(cars[i]); } } } maxPriceCar(cars); return deferred.resolve;
test2
function maxPriceCar2(cars) { let maxPriceCars = [cars[0]]; for (let i = 1;i<cars.length;i++) { if (cars[i].price>maxPriceCars[0].price) { maxPriceCars = [cars[i]]; } else if (cars[i].price==maxPriceCars[0].price) { maxPriceCars.push(cars[i]); } let x = Math.max(1,2,3,4,5,6,7,cars[i].price,6,7,8,9,9000); } } maxPriceCar2(cars); return deferred.resolve;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
1
test2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser/OS:
Chrome 146 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
1
11815866.0 Ops/sec
test2
3091406.2 Ops/sec
Related benchmarks:
testdfdf
if cond
!== vs ===
Nathan C test
=== vs ==
if vs else
123456bekir1
Clone tests
Reduce + for of vs Map and nested for of
Comments
Confirm delete:
Do you really want to delete benchmark?