Comparing gameObjects

When comparing gameObjects, is it faster to compare the gameObjects itself or to compare their names?

if(gameObjectA == gameObjectB ){}

if(gameObjectA.name == gameObjectB.name ){}

I’ve read, that comparing strings is just slower then everything else, but I cant believe this …

I think comparing objects compares references, which should be fast. Comparing names is slower, but really, with today’s machines, it won’t matter. That said, names don’t need to be unique so you could get unintended matches. You can always compare instance IDs