CPU Usage vs Memory Usage
Which would be a better trade-off?
Option #1: Code:
Option #2: Code:
Option #3: (This wasn't originally included, but I'm curious) Code:
|
Re: CPU Usage vs Memory Usage
I didn't look at your code, I just read the topic title. My answer is this: You're not going to get busted by a GSP for a little bit higher memory usage as much as you'd get busted for raising the CPU usage.
|
Re: CPU Usage vs Memory Usage
<3 option 3, + doesn't use lot of memory :)
For such a forward, you have better to limit native calls as much as you can. W/o option 3, 1600 is not so big, as you may use this size for a motd for example. I think [1600] vs [1600>>5] is negligeable (cpu usage) if you compare [1600] vs entity_get_XXX. |
Re: CPU Usage vs Memory Usage
Quote:
Quote:
Is limiting native calls worth the amount of memory being used? |
Re: CPU Usage vs Memory Usage
I agree with Connor and Brad. But in your example using just one native (pev) I would guess it's fine too. It's not something will eat your cpu. But if you plan to use severals natives when you can avoid it for sure I would prefer to use more memory. ( at least in the case of forward called very often )
|
Re: CPU Usage vs Memory Usage
Furthermore, if ents are not custom ents but common ents, pev_XuserX can be used by other plugins, but this is a bit unrelated.
|
Re: CPU Usage vs Memory Usage
ALWAYS optimize for speed.
|
Re: CPU Usage vs Memory Usage
Exolent it really comes down to what your plugin needs. For example, in one of my plugins I have literally run out of memory (even with #pragma dynamic) and am resorting to changing many things in the plugin and will be dividing it into sub-plugins.
As others have said, I don't think one native call would be that cpu intensive so I would probably opt for that method. |
Re: CPU Usage vs Memory Usage
Quote:
I was going to just go with what arkshine said, but you make a valid point, too. Thanks everyone! (I would +karma, but you all know what happened :roll:) |
| All times are GMT -4. The time now is 01:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.