OK!
I have figured out why it takes so long!
It's not the condition. Its the loop. Even with an empty looping, the calculation of the coordinates takes ages...
Therefore, I've made lots of modifications to the original script... And now I have full speed functions working!
The problem is that it is killing my little baby (or "old buddy 400" as I use to call it). However, I assume that you guys have much better pc's than me, so, give it a try!
Here goes a sample - notice that I've attached a mission with lots of demo functions to be tested and analysed - :
comment {
By MorMel
Features:
Detects the nearest covering objects or roads at given positions
Detects terrain elevation per position - Not Coded Yet
};
private ["_objs","_marks","_buildings","_elevations","_roads","_covers","_trees","_forests","_i","_j","_l","_w","_x","_y","_angle","_incr" ];
_i = (_this select 0) select 0;
_j = (_this select 0) select 1;
_l = ((_this select 1) select 0) / 2;
_w = ((_this select 1) select 1) / 2;
_angle = _this select 2;
_incr = _this select 3;
_objs=[];
_marks=[];
_buildings=[];
_roads=[];
_covers=[];
_trees=[];
_forest=[];
_x = _i - _l;
While "_x <= _i + _l" Do
{
   _y = _j - _w;
   While "_y <= _j + _w" Do
   {
      IF ({(isNull _x)||(_x in _objs)||(_x in _buildings)} count [nearestObject [_x,_y,3]] == 0)
      THEN
      {
         IF (format["%1",typeOf _x] == "")
         THEN
         {
            _objs = _objs + [nearestObject [_x,_y,3]]
         };
         ELSE
         {
            IF ("House" countType [nearestObject [_x,_y,3]] == 1)
               THEN
               {
                  _buildings = _buildings + [nearestObject [_x,_y,3]]
               };
         };
      };
      IF ((isNull _x)||(_x in _marks)} count [nearestObject [[_x,_y,0],"Mark"] == 0)
      THEN
      {
         _marks = _marks + [nearestObject [[_x,_y,0],"Mark"]]
      };
      _y = _y + _incr;
   };
   _x = _x + _incr;
};
{
   IF (position _x select 2 < 0.2)
   THEN
   {
      _roads=_roads+[_x]
   }
   ELSE
   {
      IF (position _x select 2 < 6.5)
      THEN
      {
         _covers=_covers+[_x];
      }
      ELSE
      {
         IF ((position _x select 2 > 15)&&((getdir _x)in[0,270,90,180]))
         THEN
         {
            _forest=_forest+[_x]
         }
         ELSE
         {
            _trees=_trees+[_x]
         }
      }
   }
} forEach _objs;
comment {
_temp_ref = "EmptyDetector" CamCreate [0,0,0]
{
   _elevations = _elevations + [_x,[_temp_ref,_x call loadfile "Altitude.sqf"]
} forEach _marks;
end comment};
hint format ["total: %1\nroads: %2\nrocks&bushes: %3\ntrees: %4\nforests: %5",count _objs, count _roads,count _covers, count _trees, count _forest];
Don't forget the attachment!
#Edit
I just forgot to say:
Most of the functions included in the attachment are just for reference... Only the "MMK_GeoScanner.sqs" script, the "MMK_GeographicalChecker.sqf" and "MMK_GeographicalScanner_FullLag2.sqf" functions are currently being used for the testing the mission.