Cogito, ergo sum

UE3 talk:Insertion Sort Macro

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 12:50, 16 September 2009 by Elmuerte (Talk | contribs)

Jump to: navigation, search

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)