Mostly Harmless

Difference between revisions of "UE3 talk:Insertion Sort Macro"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(Created page with '== Possible Optimization == Right now within the inner loop it compares the two elements 3 times. A == B, A > B, B > A. But general rules dictate, that if !(A > B), and !(B > A)…')
 
m
Line 1: Line 1:
 
== Possible Optimization ==
 
== Possible Optimization ==
  
Right now within the inner loop it compares the two elements 3 times. A == B, A > B, B > A. But general rules dictate, that if !(A > B), and !(B > A) then it must be A == B, right? (As also explained in the document). So the first compare is actually not needed, thus reducing the requirement for a additional operator to implement for custom types. Is my assumption correct? --[[User:Elmuerte|Elmuerte]] 19:49, 16 September 2009 (UTC)
+
Right now within the inner loop it compares the two elements 3 times. A == B, A > B, B > A. But general rules dictate, that if !(A > B), and !(B > A) then it must be A == B, right? (As also explained in the document). So the first compare is actually not needed, thus reducing the requirement for a additional operator to implement for custom types. Is my assumption correct? --[[User:Elmuerte|elmuerte]] 19:49, 16 September 2009 (UTC)

Revision as of 12:50, 16 September 2009

Possible Optimization

Right now within the inner loop it compares the two elements 3 times. A == B, A > B, B > A. But general rules dictate, that if !(A > B), and !(B > A) then it must be A == B, right? (As also explained in the document). So the first compare is actually not needed, thus reducing the requirement for a additional operator to implement for custom types. Is my assumption correct? --elmuerte 19:49, 16 September 2009 (UTC)