View Single Post
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 01-03-2012 , 10:51   Re: Does timers help to handle large checks?
Reply With Quote #8

Yeah, reducing native calls help sometimes, but stuff like IsClientConnected and GetConVarInt are trivial. They probably cost less than a microsecond alone. If you're reading these values in a loop it might be worth caching it outside the loop, though.

But I don't think this block of code posted have any expensive operations. I recently did a performance test with dynamic function calling within a plugin (attached). The average overhead for a dynamic function call was around 250-450 ns compared to 10 ns for a static function call. Even though the difference is big, we're still only talking about nanoseconds.

Everyone should try the profiler on their plugins to see how well their code is performing.

My test plugin for dynamic calls:
Attached Files
File Type: sp Get Plugin or Get Source (dyncalltest.sp - 261 views - 4.9 KB)
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)

Last edited by rhelgeby; 01-03-2012 at 10:51.
rhelgeby is offline
Send a message via MSN to rhelgeby