Raised This Month: $51 Target: $400
 12% 

g[s]et_cvar and g[s]et_pcvar


Post New Thread Reply   
 
Thread Tools Display Modes
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-06-2007 , 03:25   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #11

Quote:
Originally Posted by l4ulwtlln View Post
does the speed much that much of a difference?
You have to realise that programmers often have little to no social lives, and often simply need something to keep them occupied - We call it speed.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
l4ulwtlln
Member
Join Date: Aug 2007
Old 11-07-2007 , 00:20   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #12

lol i just realized how bad i wrote that sentence.

so does someone want to give an example of why speed is so much more important?
l4ulwtlln is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 11-07-2007 , 00:40   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #13

Quote:
Originally Posted by l4ulwtlln View Post
lol i just realized how bad i wrote that sentence.

so does someone want to give an example of why speed is so much more important?
How about a real life example:

Would you want to rush your dying son to the hospital by taking the fastest route (even if it means running red lights)? Or take your time to get there, like obey the speed limits, traffic signals, etc.

While both are important, speed is the more preferrable way to go. Memory usage shouldn't be entirely a problem, since most servers are better-than-decent
__________________
M249-M4A1 is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-07-2007 , 03:37   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #14

While we appreciate the bloody analogy, I'd reckon rushing and ignoring the street signs and regulations would be equivelant to typing it as quickly as you can and not even indenting or thinking efficiently at all. The irony of this is that to make your plugin fast, you have to write it slower - and think about it more.

And hell yes, I'm debating symantics. Reference my last post for the reason why.

I'd say speed and efficiency is like using proper equipment, such as a vaccuum cleaner, to conduct an abortion, thus not damaging the female or the uteris. The alternative is just to jam a coat hanger up there and start poking flesh until it falls out.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician

Last edited by Wilson [29th ID]; 11-07-2007 at 03:40.
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 11-07-2007 , 03:45   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #15

How about just using the ACTUAL CASE, instead of making a lot of confusing and stupid analogies?

The CVAR structure is an enormous linked list, meaning that every time you use the normal syntax for getting CVAR's, you have the potential to force the server to check every single CVAR. This is O(N) performance, or linear, and is absolutely terrible.

The server itself registers lots of CVAR's, other plugins register CVAR's, and your plugin registers CVAR's. This means that your one little call to find a CVAR's value could very well be hundreds of string comparisons and indirections (and usually is).

However, if you use the pointer syntax, you reduce this huge overhead to a single indirection, O(1) performance, which is the best performance possible, and worlds better than the other syntax.

You waste 1 cell of memory, 4 bytes, in order to reduce an operation which is potentially hundreds of string comparisons, hundreds of indirections, and millions of cycles, to a single indirection, perhaps a hundred cycles, less if it is in cache.

Save a million cycles, waste 4 bytes, make your code a little more complex.

This isn't about a memory / speed tradeoff. Trade off implies that there is some benefit either way over the other. There is absolutely no benefit to saving 4 bytes today, even on the smallest of microprocessors, if it means wasting potentially millions of cycles.
__________________

Last edited by Twilight Suzuka; 11-07-2007 at 03:54.
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
l4ulwtlln
Member
Join Date: Aug 2007
Old 11-07-2007 , 22:23   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #16

now that you have pointed out that g[s]et_cvar has to cycle through many other cvars before it takes any action then i see what you mean now. thank you for your very informative answer
l4ulwtlln is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode