-
July 8th, 2013, 11:22 PM
#1
Regarding Loops
Hi everyone
I am writing a MMORPG server (just the server) and I am starting to focus on the "lightweight-ness" and effeciency of it.
I am going to give an extremely short version of my question;
I am going to use a loop to look through around 10-100 objects every minute and have an If/else statement in there. How much does a loop like this effect on my server ? It might be a silly question but I am debating on whether to create an object for every 100 instances (of clients) and then loop through 1-6 objects instead. Which one would work more effeciently ?
if this didn't make any sense I'll try to explain it differently. Imagine around 100 clients in a map. I am trying to find 8 of those clients that are related to each other (theyre in a group/party). Would it be wisest to loop through all 100 stand alone clients to find the 8 ones, or use around 10 Objects (in this case called groups/partys) and look throughout those instead ? (each group contains 8 clients). Remember, either way this check will happen every minute or so.
Thanks! I am curious about the responses !
-
July 8th, 2013, 11:46 PM
#2
Re: Regarding Loops
Originally Posted by wutang001
Thanks! I am curious about the responses !
Me too. Why not test both approaches and report back?
-
July 9th, 2013, 12:48 AM
#3
Re: Regarding Loops
Originally Posted by Arjay
Me too. Why not test both approaches and report back?
I am not sure how I should test this lol.
-
July 9th, 2013, 12:50 PM
#4
Re: Regarding Loops
Just code up it both ways and load test each (i.e. rather than testing only 10-1000 object per minute, try to max out the amount that can be processed in a minute). If there is a significant difference between the two approaches, go with the highest one; otherwise if they are about equal in performance, go with the one that is easier to maintain.
-
July 9th, 2013, 12:56 PM
#5
Re: Regarding Loops
Originally Posted by Arjay
Just code up it both ways and load test each (i.e. rather than testing only 10-1000 object per minute, try to max out the amount that can be processed in a minute). If there is a significant difference between the two approaches, go with the highest one; otherwise if they are about equal in performance, go with the one that is easier to maintain.
Thanks, but I ment that I don't know how to actually get benchmarks. Do I use Visual Studio? Also, what would be the most effecient way of making 1000 copies of an object without using a loop ? (So I can use it for testing)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|