Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
testing12123123
(version: 0)
Comparing performance of:
1 vs 2 vs 3
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function searchInsert(nums, target) { if (nums.includes(target)) { return nums.indexOf(target); } else { nums.push(target); let sortedNums = Array.from(new Set(nums)).sort((a, b) => a - b); return sortedNums.indexOf(target); } } function searchInsert2(nums, target) { let insertIndex = 0; for (let i = 0; i < nums.length; i++) { let num = nums[i]; if (num < target) insertIndex++; if (num === target) return i; if (num > target) break; } return insertIndex; } function searchInsert3(nums, target) { let insertIndex = 0; for (let i = 0; i < nums.length; i++) { let num = nums[i]; if (num === target) return i; if (num > target) { insertIndex = i; break; } } return insertIndex; }
Tests:
1
searchInsert([2,4,6,8,10,12,14,16,18,20], 17);
2
searchInsert2([2,4,6,8,10,12,14,16,18,20], 17);
3
searchInsert3([2,4,6,8,10,12,14,16,18,20], 17);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
1
2
3
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser/OS:
Chrome 121 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
1
1351656.5 Ops/sec
2
15003418.0 Ops/sec
3
14756470.0 Ops/sec
Related benchmarks:
Smallest Common Multiple
Binary search property vs. delegate
Sorted vs unsorted Array sort
LinearSearch vs BinarySearch
Comments
Confirm delete:
Do you really want to delete benchmark?