So, I have the following kind of "Hello World" C++ project going on here: http://cpp.sh/2ttqh
...and I would like to have a head-to-head performance comparison with its B4A counterpart:
How to do it?
B4X:
// Example program Distance Between two points in 2D space.
#include <iostream>
#include <math.h>
long distance_between(long x1, long x2, long y1, long y2);
int main()
{
// this is just an example
std::cout << distance_between(123, 456, 789, 101) << "\n";
}
long distance_between(long x1, long x2, long y1, long y2)
{
return sqrt( ((x2-x1)*(x2-x1)) + ((y2-y1)*(y2-y1)) );
}
...and I would like to have a head-to-head performance comparison with its B4A counterpart:
B4X:
Sub DistanceBetween(x1 as Long, x2 as Long, y1 as Long, y2 as Long) as Long
Return Sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))
End Sub
How to do it?