diff --git a/doc/contributions.txt b/doc/contributions.txt
index 216a40c6fc396375f77b1ee822c31ff406e91aef..1099f013c240f0f239f386afda813ff8244a4ee3 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -243,6 +243,7 @@ Coaldust Numbers
 Cron Stardust
 	VWR-10579
 	VWR-25120
+	STORM-1075
 Cypren Christenson
 	STORM-417
 Dale Glass
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 532a2c1b0d779281253d84609cedb775f45ff4fc..f3cf950afae70deffcafc7a07adabcb4878f415e 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -42,10 +42,10 @@ using namespace std;
 
 #define INCHES_TO_METERS 0.02540005f
 
-const F32 POSITION_KEYFRAME_THRESHOLD = 0.03f;
+const F32 POSITION_KEYFRAME_THRESHOLD_SQUARED = 0.03f * 0.03f;
 const F32 ROTATION_KEYFRAME_THRESHOLD = 0.01f;
 
-const F32 POSITION_MOTION_THRESHOLD = 0.001f;
+const F32 POSITION_MOTION_THRESHOLD_SQUARED = 0.001f * 0.001f;
 const F32 ROTATION_MOTION_THRESHOLD = 0.001f;
 
 char gInFile[1024];		/* Flawfinder: ignore */
@@ -1196,7 +1196,7 @@ void LLBVHLoader::optimize()
 				if (ki_prev == ki_last_good_pos)
 				{
 					joint->mNumPosKeys++;
-					if (dist_vec(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD)
+					if (dist_vec_squared(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED)
 					{
 						pos_changed = TRUE;
 					}
@@ -1209,12 +1209,12 @@ void LLBVHLoader::optimize()
 					LLVector3 current_pos(ki->mPos);
 					LLVector3 interp_pos = lerp(current_pos, last_good_pos, 1.f / (F32)numPosFramesConsidered);
 
-					if (dist_vec(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD)
+					if (dist_vec_squared(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED)
 					{
 						pos_changed = TRUE;
 					}
 
-					if (dist_vec(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD)
+					if (dist_vec_squared(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD_SQUARED)
 					{
 						ki_prev->mIgnorePos = TRUE;
 						numPosFramesConsidered++;
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 95cb606240276669b171d4113d18b213e4cd46a5..d0f287657ed0b46d3a0743f9cc3af910640ffed9 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -312,6 +312,14 @@ const F32 CHAT_SHOUT_RADIUS = 100.f;
 const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS;
 const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f;
 
+// squared editions of the above for distance checks
+const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS;
+const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS;
+const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS;
+const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED;
+const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO;
+
+
 // this times above gives barely audible radius
 const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f;
 
diff --git a/indra/llmath/tests/llbbox_test.cpp b/indra/llmath/tests/llbbox_test.cpp
index 8064ab217d17c7e5d8e5126cdf58491224a1f7d6..fd0dbb58fc393d621bc16a8febe031ec431783ac 100644
--- a/indra/llmath/tests/llbbox_test.cpp
+++ b/indra/llmath/tests/llbbox_test.cpp
@@ -34,7 +34,7 @@
 
 
 #define ANGLE                (3.14159265f / 2.0f)
-#define APPROX_EQUAL(a, b)   dist_vec((a),(b)) < 1e-5
+#define APPROX_EQUAL(a, b)   (dist_vec_squared((a),(b)) < 1e-10)
 
 namespace tut
 {
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7d491a777489c0e025c8e0ebc66b0bea377cecd8..aea4e78436279602b43de48214df2e70e1626464 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1337,7 +1337,7 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
 		//NB: auto pilot can terminate for a reason other than reaching the destination
 		if (mAutoPilotFinishedCallback)
 		{
-			mAutoPilotFinishedCallback(!user_cancel && dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
+			mAutoPilotFinishedCallback(!user_cancel && dist_vec_squared(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < (mAutoPilotStopDistance * mAutoPilotStopDistance), mAutoPilotCallbackData);
 		}
 		mLeaderID = LLUUID::null;
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index c2c2e7fe22a5fc72fa9be7b1e6565b913c8f1cbe..2679dbb78bac04165b7b9564f9b6f7ef9aa77308 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -413,8 +413,9 @@ LLColor4 get_text_color(const LLChat& chat)
 		if (!chat.mPosAgent.isExactlyZero())
 		{
 			LLVector3 pos_agent = gAgent.getPositionAgent();
-			F32 distance = dist_vec(pos_agent, chat.mPosAgent);
-			if (distance > gAgent.getNearChatRadius())
+			F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
+			F32 dist_near_chat = gAgent.getNearChatRadius();
+			if (distance_squared > dist_near_chat * dist_near_chat)
 			{
 				// diminish far-off chat
 				text_color.mV[VALPHA] = 0.8f;
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index 72f64752d6fa9bde666755a3768148507e410456..b380b3fe2020abe4edb2ae026099ee31a06d05e6 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -56,7 +56,7 @@ const S32 PKT_SIZE = 57;
 // throttle
 const F32 MAX_SENDS_PER_SEC = 4.f;
 
-const F32 MIN_DELTAPOS_FOR_UPDATE = 0.05f;
+const F32 MIN_DELTAPOS_FOR_UPDATE_SQUARED = 0.05f * 0.05f;
 const F32 MIN_TARGET_OFFSET_SQUARED = 0.0001f;
 
 
@@ -416,7 +416,7 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec
 	BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject);
 
 	// lookat position has moved a certain amount and we haven't just sent an update
-	lookAtChanged = lookAtChanged || ((dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && 
+	lookAtChanged = lookAtChanged || ((dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && 
 		((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)));
 
 	if (lookAtChanged)
diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp
index bfb0f150b3e548034b92001646cae34361f76b16..28fe8e1c015f4dee42efc991e007c7e454f39528 100644
--- a/indra/newview/llhudeffectpointat.cpp
+++ b/indra/newview/llhudeffectpointat.cpp
@@ -48,7 +48,7 @@ const S32 PKT_SIZE = 57;
 // throttle
 const F32 MAX_SENDS_PER_SEC = 4.f;
 
-const F32 MIN_DELTAPOS_FOR_UPDATE = 0.05f;
+const F32 MIN_DELTAPOS_FOR_UPDATE_SQUARED = 0.05f * 0.05f;
 
 // timeouts
 // can't use actual F32_MAX, because we add this to the current frametime
@@ -244,7 +244,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob
 	BOOL targetTypeChanged = (target_type != mTargetType) ||
 		(object != mTargetObject);
 
-	BOOL targetPosChanged = (dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && 
+	BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && 
 		((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC));
 
 	if (targetTypeChanged || targetPosChanged)
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index f1c7e952d17bc76236a6fd2b480206c71b020566..6ee095475fb04fc73e69ee9fee82dc887229ef58 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -1127,7 +1127,7 @@ BOOL LLManipRotate::updateVisiblity()
 			if (gSavedSettings.getBOOL("LimitSelectDistance"))
 			{
 				F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
-				if (dist_vec(gAgent.getPositionAgent(), center) > max_select_distance)
+				if (dist_vec_squared(gAgent.getPositionAgent(), center) > (max_select_distance * max_select_distance))
 				{
 					visible = FALSE;
 				}
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 060677f9f35803b147b6a3d2987e162ac3fa6ec7..9cdc09225714958405fcf58b30de9c8a298a40b7 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -217,8 +217,6 @@ void LLManipScale::render()
 		
 		LLVector3 center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal());
 
-		F32 range;
-		F32 range_from_agent;
 		if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 		{
 			mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
@@ -226,25 +224,25 @@ void LLManipScale::render()
 		}
 		else
 		{
-			range = dist_vec(gAgentCamera.getCameraPositionAgent(), center_agent);
-			range_from_agent = dist_vec(gAgent.getPositionAgent(), center_agent);
+			F32 range_squared = dist_vec_squared(gAgentCamera.getCameraPositionAgent(), center_agent);
+			F32 range_from_agent_squared = dist_vec_squared(gAgent.getPositionAgent(), center_agent);
 
 			// Don't draw manip if object too far away
 			if (gSavedSettings.getBOOL("LimitSelectDistance"))
 			{
 				F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
-				if (range_from_agent > max_select_distance)
+				if (range_from_agent_squared > max_select_distance * max_select_distance)
 				{
 					return;
 				}
 			}
 
-			if (range > 0.001f)
+			if (range_squared > 0.001f * 0.001f)
 			{
 				// range != zero
 				F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
 				F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView();  // radians
-				mBoxHandleSize = range * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR;
+				mBoxHandleSize = fsqrtf(range_squared) * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR;
 			}
 			else
 			{
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 981b4dbee3afc964ffb1c5d1a5a2f91ebb54d2a8..5fe5c9b1e8a4e03c0073cd053ee3599f8f1d3633 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -330,8 +330,8 @@ void LLNetMap::draw()
 		//localMouse(&local_mouse_x, &local_mouse_y);
 		LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
 		mClosestAgentToCursor.setNull();
-		F32 closest_dist = F32_MAX;
-		F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE; 
+		F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop
+		F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE);
 
 		// Draw avatars
 		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
@@ -410,11 +410,11 @@ void LLNetMap::draw()
 					}
 				}
 
-				F32	dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
+				F32	dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
 											  LLVector2(local_mouse_x,local_mouse_y));
-				if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist)
+				if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
 				{
-					closest_dist = dist_to_cursor;
+					closest_dist_squared = dist_to_cursor_squared;
 					mClosestAgentToCursor = regionp->mMapAvatarIDs.get(i);
 				}
 			}
@@ -451,9 +451,9 @@ void LLNetMap::draw()
 					  dot_width,
 					  dot_width);
 
-			F32	dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
+			F32	dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
 										  LLVector2(local_mouse_x,local_mouse_y));
-			if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist)
+			if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
 			{
 				mClosestAgentToCursor = gAgent.getID();
 			}
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index b52f33ec3b62eddb0decddad0c1976612bce6473..e3a7b749ea6be37294d2204355fe42feb2988928 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -158,9 +158,8 @@ class LLAvatarItemDistanceComparator : public LLAvatarItemComparator
 		const LLVector3d& me_pos = gAgent.getPositionGlobal();
 		const LLVector3d& item1_pos = mAvatarsPositions.find(item1->getAvatarId())->second;
 		const LLVector3d& item2_pos = mAvatarsPositions.find(item2->getAvatarId())->second;
-		F32 dist1 = dist_vec(item1_pos, me_pos);
-		F32 dist2 = dist_vec(item2_pos, me_pos);
-		return dist1 < dist2;
+		
+		return dist_vec_squared(item1_pos, me_pos) < dist_vec_squared(item2_pos, me_pos);
 	}
 private:
 	id_to_pos_map_t mAvatarsPositions;
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 87a2008e2bd167cd86ce8bee19a54a94b06a8ec7..f05892d9b0943524997e3577b93600b9aa32c749 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -6568,26 +6568,27 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ,
 	if (update_position)
 	{
 		// calculate the distance of the object closest to the camera origin
-		F32 min_dist = 1e+30f;
+		F32 min_dist_squared = F32_MAX; // value will be overridden in the loop
+		
 		LLVector3 obj_pos;
 		for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
 			 it != getSelection()->root_end(); ++it)
 		{
 			obj_pos = (*it)->getObject()->getPositionEdit();
 			
-			F32 obj_dist = dist_vec(obj_pos, LLViewerCamera::getInstance()->getOrigin());
-			if (obj_dist < min_dist)
+			F32 obj_dist_squared = dist_vec_squared(obj_pos, LLViewerCamera::getInstance()->getOrigin());
+			if (obj_dist_squared < min_dist_squared)
 			{
-				min_dist = obj_dist;
+				min_dist_squared = obj_dist_squared;
 			}
 		}
 		
-		// factor the distance inside the displacement vector. This will get us
+		// factor the distance into the displacement vector. This will get us
 		// equally visible movements for both close and far away selections.
-		min_dist = sqrt(min_dist) / 2;
-		displ_global.setVec(displ.mV[0]*min_dist, 
-							displ.mV[1]*min_dist, 
-							displ.mV[2]*min_dist);
+		F32 min_dist = sqrt(fsqrtf(min_dist_squared)) / 2;
+		displ_global.setVec(displ.mV[0] * min_dist,
+							displ.mV[1] * min_dist,
+							displ.mV[2] * min_dist);
 
 		// equates to: Displ_global = Displ * M_cam_axes_in_global_frame
 		displ_global = LLViewerCamera::getInstance()->rotateToAbsolute(displ_global);
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 40aea058397345450d5216f98b24eec130a67942..c588bd8fb44e63a6c8dfcaa601512c16094c5d02 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -920,7 +920,7 @@ void LLLocalSpeakerMgr::updateSpeakerList()
 		if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
 		{
 			LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
-			if (!avatarp || dist_vec(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS)
+			if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS_SQUARED)
 			{
 				setSpeakerNotInChannel(speakerp);
 			}
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp
index f5484ff010376dc764ea70db7e157158d48567db..e7a0d17c3a42ed3e1e385437e51bd4595bfa9db8 100644
--- a/indra/newview/llviewerchat.cpp
+++ b/indra/newview/llviewerchat.cpp
@@ -90,8 +90,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
 		if (!chat.mPosAgent.isExactlyZero())
 		{
 			LLVector3 pos_agent = gAgent.getPositionAgent();
-			F32 distance = dist_vec(pos_agent, chat.mPosAgent);
-			if (distance > gAgent.getNearChatRadius())
+			F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
+			F32 dist_near_chat = gAgent.getNearChatRadius();
+			if (distance_squared > dist_near_chat * dist_near_chat)
 			{
 				// diminish far-off chat
 				r_color.mV[VALPHA] = 0.8f;
@@ -155,8 +156,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, std::string& r_color_name, F
 		if (!chat.mPosAgent.isExactlyZero())
 		{
 			LLVector3 pos_agent = gAgent.getPositionAgent();
-			F32 distance = dist_vec(pos_agent, chat.mPosAgent);
-			if (distance > gAgent.getNearChatRadius())
+			F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
+			F32 dist_near_chat = gAgent.getNearChatRadius();
+			if (distance_squared > dist_near_chat * dist_near_chat)
 			{
 				// diminish far-off chat
 				r_color_alpha = 0.8f; 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index cfffc6ecc96f6677620c7fa1cec835911c1885d7..3f018fc57cceb5177e2df42ac7c06fc2d0818f1a 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -122,6 +122,7 @@
 //
 const F32 BIRD_AUDIBLE_RADIUS = 32.0f;
 const F32 SIT_DISTANCE_FROM_TARGET = 0.25f;
+const F32 CAMERA_POSITION_THRESHOLD_SQUARED = 0.001f * 0.001f;
 static const F32 LOGOUT_REPLY_TIME = 3.f;	// Wait this long after LogoutReply before quitting.
 
 // Determine how quickly residents' scripts can issue question dialogs
@@ -4745,7 +4746,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	BOOL force_mouselook;
 	mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
 
-	if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
+	if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > CAMERA_POSITION_THRESHOLD_SQUARED)
 	{
 		gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
 	}
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index d07e06f6a7ed171e7864517bcc8b6eaa89f287cf..26765bdd01e00e65c49aa017a59bdf0c2ccbeafe 100644
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -833,7 +833,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()
 	U8* colorp;
 	bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build");
 
-	const F32 PROPERTY_LINE_CLIP_DIST = 256.f;
+	const F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f;
 
 	for (i = 0; i < mVertexCount; i += vertex_per_edge)
 	{
@@ -844,7 +844,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()
 		vertex.mV[VY] = *(vertexp+1);
 		vertex.mV[VZ] = *(vertexp+2);
 
-		if (dist_vec_squared2D(vertex, camera_region) > PROPERTY_LINE_CLIP_DIST*PROPERTY_LINE_CLIP_DIST)
+		if (dist_vec_squared2D(vertex, camera_region) > PROPERTY_LINE_CLIP_DIST_SQUARED)
 		{
 			continue;
 		}
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 08e242af8eb78a4eb45223041da8c43302f1a691..08581be38bec438e5d041b626f5803810d8891b8 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -5088,7 +5088,7 @@ void LLVivoxVoiceClient::enforceTether(void)
 		}
 	}
 	
-	if(dist_vec(mCameraPosition, tethered) > 0.1)
+	if(dist_vec_squared(mCameraPosition, tethered) > 0.01)
 	{
 		mCameraPosition = tethered;
 		mSpatialCoordsDirty = true;
@@ -5150,7 +5150,7 @@ void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLV
 
 void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
 {
-	if(dist_vec(mAvatarPosition, position) > 0.1)
+	if(dist_vec_squared(mAvatarPosition, position) > 0.01)
 	{
 		mAvatarPosition = position;
 		mSpatialCoordsDirty = true;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 6b2af1f8b7a81c79936fc6ae7daf0bc51461df15..8f500414745079de5f68f0cb4f63c98827b81f5a 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -1438,6 +1438,8 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3
 
 void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
 {
+	F32 radius_squared = radius * radius;
+	
 	if(avatar_ids != NULL)
 	{
 		avatar_ids->clear();
@@ -1458,7 +1460,7 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 			if(!uuid.isNull())
 			{
 				LLVector3d pos_global = pVOAvatar->getPositionGlobal();
-				if(dist_vec(pos_global, relative_to) <= radius)
+				if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
 				{
 					if(positions != NULL)
 					{
@@ -1482,7 +1484,7 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 		for (S32 i = 0; i < count; i++)
 		{
 			LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
-			if(dist_vec(pos_global, relative_to) <= radius)
+			if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
 			{
 				LLUUID uuid = regionp->mMapAvatarIDs.get(i);
 				// if this avatar doesn't already exist in the list, add it