Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
geosailing
(version: 1)
Comparing performance of:
case1 vs case2 vs case3 vs case4 vs case5
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function geosailing(latA, lngA, latB, lngB) { try { return (Math.acos(Math.sin(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.sin(Math.atan(Math.tan(latB * (Math.PI / 180)))) + Math.cos(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.cos(Math.atan(Math.tan(latB * (Math.PI / 180)))) * Math.cos(lngA * (Math.PI / 180) - lngB * (Math.PI / 180))) * 6371.008); } catch { return 0; } } var dist_cache = {}; function geosailing2(latA, lngA, latB, lngB) { if (dist_cache[latA] && dist_cache[latA][lngA] && dist_cache[latA][lngA][latB] && dist_cache[latA][lngA][latB][lngB]) { return dist_cache[latA][lngA][latB][lngB]; } else { var dist = Math.acos(Math.sin(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.sin(Math.atan(Math.tan(latB * (Math.PI / 180)))) + Math.cos(Math.atan(Math.tan(latA * (Math.PI / 180)))) * Math.cos(Math.atan(Math.tan(latB * (Math.PI / 180)))) * Math.cos(lngA * (Math.PI / 180) - lngB * (Math.PI / 180))) * 6371.008; if (!dist_cache[latA]) dist_cache[latA] = {}; if (!dist_cache[latA][lngA]) dist_cache[latA][lngA] = {}; if (!dist_cache[latA][lngA][latB]) dist_cache[latA][lngA][latB] = {}; dist_cache[latA][lngA][latB][lngB] = dist; return dist; } } function geosailing3(a,b,c,d){ with(Math)return acos(sin(a*PI/180)*sin(c*PI/180)+cos(a*PI/180)*cos(c*PI/180)*cos(b*PI/180-d*PI/180))*6371.008 } function geosailing4(a,b,c,d){ with(Math)return acos(sin(a*(i=PI/180))*sin(c*i)+cos(a*i)*cos(c*i)*cos(b*i-d*i))*6371.008 } function geosailing5(a,b,c,d){ with(Math)return acos(sin(a*=(i=PI/180))*sin(c*=i)+cos(a)*cos(c)*cos(b*i-d*i))*6371.008 }
Tests:
case1
geosailing(20.24,50.11,2.88,9.23)
case2
geosailing2(20.24,50.11,2.88,9.23)
case3
geosailing3(20.24,50.11,2.88,9.23)
case4
geosailing4(20.24,50.11,2.88,9.23)
case5
geosailing5(20.24,50.11,2.88,9.23)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
case1
case2
case3
case4
case5
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
case1
146525456.0 Ops/sec
case2
6031582.5 Ops/sec
case3
840252.6 Ops/sec
case4
726925.2 Ops/sec
case5
747362.4 Ops/sec
Related benchmarks:
Haversine
trigata
trigata
trigata
trigata
Testando
Haversine performance
geosailing2
geosailing3
Comments
Confirm delete:
Do you really want to delete benchmark?