Raised This Month: $ Target: $400
 0% 

[TUT/Snippet] Doing timed stuff without CreateTimers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 02-11-2015 , 21:46   Re: [TUT/Snippet] Doing timed stuff without CreateTimers
Reply With Quote #1

Quote:
Originally Posted by lingzhidiyu View Post
I want know how much performance cost in this code.

PHP Code:
PreThink(client)
{
    if (!
AllowThis1[client])
    {
        return;
    }
    if (!
AllowThis2[client])
    {
        return;
    }
        
//and more bool...........

https://forums.alliedmods.net/showpo...09&postcount=3

Comparatively a couple of bools shouldn't be bad. Unless you have like hundreds of bools. I try to use switch cases... according to Psychonic or Asherkin they don't calculate every comparison for every switch or something, just jump to whichever case.
__________________

Last edited by Chdata; 02-11-2015 at 21:49.
Chdata is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-12-2015 , 16:08   Re: [TUT/Snippet] Doing timed stuff without CreateTimers
Reply With Quote #2

Quote:
Originally Posted by Chdata View Post
https://forums.alliedmods.net/showpo...09&postcount=3

Comparatively a couple of bools shouldn't be bad. Unless you have like hundreds of bools. I try to use switch cases... according to Psychonic or Asherkin they don't calculate every comparison for every switch or something, just jump to whichever case.
It's pretty common for a compiler to generate a jump table for a switch instead of treating it like an if / else if / else block.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 18:28.


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