Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created May 4, 2017 13:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unitycoder/187ee364b803ba038f0e12e2a35484ff to your computer and use it in GitHub Desktop.
Save unitycoder/187ee364b803ba038f0e12e2a35484ff to your computer and use it in GitHub Desktop.
Faster Equal Vector3 Check
// 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