Thread: What would be more efficient?

Results 1 to 9 of 9
  1. #1 What would be more efficient? 
    isAwesome = true;
    Typhoeus's Avatar
    Join Date
    Nov 2008
    Posts
    815
    Thanks given
    18
    Thanks received
    13
    Rep Power
    246
    I'm making a global event system for my server, so I'm making the events called on server startup and then are run for every player (for stuff like announcments, etc). I was wondering, which would be more efficient, make one event that checks every 500 ms and put all things even if they have different timings in it, or have a different event for every timing, like one event for 20000ms one for 5000ms one for 1000ms etc.
    Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction.
    - Albert Einstein

    It is one thing to show a man that he is in an error, and another to put him in possession of the truth.
    - John Locke
    Reply With Quote  
     

  2. #2  
    Revolution
    Guest
    I would imagine calling it every 500ms would be best. Then you wouldn't have to wait for the next event.

    Regards,

    Brandon
    Reply With Quote  
     

  3. #3  
    isAwesome = true;
    Typhoeus's Avatar
    Join Date
    Nov 2008
    Posts
    815
    Thanks given
    18
    Thanks received
    13
    Rep Power
    246
    Quote Originally Posted by Revolution View Post
    I would imagine calling it every 500ms would be best. Then you wouldn't have to wait for the next event.

    Regards,

    Brandon
    I'm talking about which would use less CPU power etc.
    Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction.
    - Albert Einstein

    It is one thing to show a man that he is in an error, and another to put him in possession of the truth.
    - John Locke
    Reply With Quote  
     

  4. #4  
    Registered Member
    Deadly Uzi's Avatar
    Join Date
    Jul 2008
    Posts
    994
    Thanks given
    177
    Thanks received
    87
    Rep Power
    362
    I'd image 500ms because that only needs one event and for the others, you would need three events, plus for the 500 one, you don't really do anything 60% of the time
    Attempting to develop a multi-revision library. See it on GitHub.
    Reply With Quote  
     

  5. #5  
    isAwesome = true;
    Typhoeus's Avatar
    Join Date
    Nov 2008
    Posts
    815
    Thanks given
    18
    Thanks received
    13
    Rep Power
    246
    Quote Originally Posted by Deadly Uzi View Post
    I'd image 500ms because that only needs one event and for the others, you would need three events, plus for the 500 one, you don't really do anything 60% of the time
    Yes, but I'm not sure if it would take less CPU to run multiple events and only check every, say 20 seconds, versus checking every 0.5 second.

    So would running a few events use less CPU power or would Checking all the things every 500ms?
    Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction.
    - Albert Einstein

    It is one thing to show a man that he is in an error, and another to put him in possession of the truth.
    - John Locke
    Reply With Quote  
     

  6. #6  
    Banned


    Join Date
    Jul 2006
    Posts
    104
    Thanks given
    0
    Thanks received
    0
    Rep Power
    149
    Quote Originally Posted by Playernt View Post
    Yes, but I'm not sure if it would take less CPU to run multiple events and only check every, say 20 seconds, versus checking every 0.5 second.

    So would running a few events use less CPU power or would Checking all the things every 500ms?
    I don't understand what you mean by 20 seconds versus half a second relevant to server load, I'd need an example how you plan to go about this to give a accurate answer.

    Ex Administrator of RS-Server
    Reply With Quote  
     

  7. #7  
    Revolution
    Guest
    Well, honestly, you could do the 20 seconds way for less CPU, but in return you would get less quality of handling.

    Regards,

    Brandon
    Reply With Quote  
     

  8. #8  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    Depend of what event at 500ms and what event at 1000ms , is a good thing you made events so Good Luck I prefer at 500ms
    Reply With Quote  
     

  9. #9  
    isAwesome = true;
    Typhoeus's Avatar
    Join Date
    Nov 2008
    Posts
    815
    Thanks given
    18
    Thanks received
    13
    Rep Power
    246
    You guys seem to have no clue what you are talking about.

    Which would use less CPU load, running one event, at a delay of 500ms globaly, that checks everything, kind of like process only in an event form, or having multiple events such as, one at 500ms, one at 3000ms one at 50000ms etc, etc. If I did the latter it wouldn't have to use the CPU power to go through all the "if" statements, but it would also be running more than one event.

    I will probably end up using the multiple events idea.
    Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction.
    - Albert Einstein

    It is one thing to show a man that he is in an error, and another to put him in possession of the truth.
    - John Locke
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

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