It's a global function, called for all entities which think. So, yes, the entity's index is passed.
An entity is thinking because it requires checks for different purposes. Like when you throw a grenade, you know it explodes after 2,5 seconds, and the "grenade" entity is thinking to check when it should explode.
Look, how you can know what to optimize when you don't even know what you're doing nor understanding such basic code ? What you do doesn't make sense.