Created
May 4, 2017 13:54
-
-
Save unitycoder/187ee364b803ba038f0e12e2a35484ff to your computer and use it in GitHub Desktop.
Faster Equal Vector3 Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/JoachimHolmer/status/859974266233794560 | |
// tested with 10million random vectors | |
// 1100ms | |
public static bool EqualVector3(Vector3 a, Vector3 b) | |
{ | |
return a==b; | |
} | |
// 98ms | |
public static bool EqualVector3Fast(Vector3 a, Vector3 b) | |
{ | |
return !(a.x!=b.x || a.y!=b.y || a.z!=b.z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment