Cvar and Pcvar
Well in biggest part i use pcvar and not cvar.
But i dont understand why pcvar is more efficient then cvar. Can someone explain me? |
Re: Cvar and Pcvar
|
Re: Cvar and Pcvar
In a fast and simplistic explanation : when you register a cvar, this one is saved in a big list. To access to a specific cvar of this list, you need to search by the cvar name, so comparing each name, until you find the one you want do do things. It's a slow process. Instead, you could point directly on a cvar, like in Pawn you would know the index of an array, here it's not an index, but more a "pointer". That's the point of using pcvar (p for pointer). You don't need to know what is really a pointer in C (that's something you can search). So : get_cvar_* will search by name in the big list to know the "pointer" , get_pcvar_* will access directly to the "pointer" in memory ; that's why it's way faster.
|
Re: Cvar and Pcvar
Quote:
|
Re: Cvar and Pcvar
Here is a good yet whimsical analogy by Joaquim: https://forums.alliedmods.net/showpo...52&postcount=7
|
| All times are GMT -4. The time now is 10:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.