A modern computer should handle 10000 calls to Entitydistance with little fuss.
The speed of a 3d vs 2d version of Distance is going to be negligible, even with 10000 calls.
If you must use a 2d version of Distance, just compare the squared distance. The below is more efficient than (x-x1)^2 etc... but likely LESS efficient than using the native EntityDistance function which defeats the purpose.
;Is Distance < 100
Distance# = ( (x-x1) * (x-x1) + (y-y1) * (y-y1) )
If Distance < ( 100 * 100 ) { Do Something }
The speed of a 3d vs 2d version of Distance is going to be negligible, even with 10000 calls.
If you must use a 2d version of Distance, just compare the squared distance. The below is more efficient than (x-x1)^2 etc... but likely LESS efficient than using the native EntityDistance function which defeats the purpose.
;Is Distance < 100
Distance# = ( (x-x1) * (x-x1) + (y-y1) * (y-y1) )
If Distance < ( 100 * 100 ) { Do Something }