Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Opinion on Alphabetic Sort

 
Post new topic   Reply to topic Printable version
 View previous topic  Tree-View Dragging? Post :: Post Looking for fast random number algorit...  View next topic  
Author Message
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Mar 06, 2006 8:06 pm    Post subject: Opinion on Alphabetic Sort Reply to topic Reply with quote

In an effort to make a program more customizeable, some data that used to be hardcoded is now read from an XML file on load. This data sometimes has to be sorted alphabetically.

Since the data used to be static, I just had a lookup array to perform the sorting really quickly, but now of course I can't do that hardcoded. So: is it worth it to build the array when the data is loaded? Or should I just let it sort on-the-fly?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
D1st0rt
Miss Directed Wannabe


Age:30
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Mar 06, 2006 8:20 pm    Post subject: Reply to topic Reply with quote

How often is the data changing? Just once per run/load/whatever?
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Mar 06, 2006 10:24 pm    Post subject: Reply to topic Reply with quote

Only once per run. Sorry, I should have made that clearer.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
D1st0rt
Miss Directed Wannabe


Age:30
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Tue Mar 07, 2006 2:14 pm    Post subject: Reply to topic Reply with quote

If your data structure preserves order, couldn't you just sort it at the very beginning and have it always in order? If not, you could probably just make a sorted array at the beginning and keep it around for ez lookups.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Mar 07, 2006 9:41 pm    Post subject: Reply to topic Reply with quote

To put it simply, different combinations of the list have to be sorted, depending on user input. So I can't just sort it at the beginning.

Thanks.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:32
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Mar 07, 2006 11:39 pm    Post subject: Reply to topic Reply with quote

It sounds like a time/space tradeoff.

Is this list massively huge? If the answer is no, then it doesn't matter which way you do it. Computers are fast and can sort data quickly. Computers also have lots of ram and can hold it all after computing it once.

If it is massively huge, then the question you want to ask is "do I want it to run slowly, or have a large memory footprint?"
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:30
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Mar 08, 2006 6:46 pm    Post subject: Reply to topic Reply with quote

It's not huge, usually less than 900 entires. But the size doesn't affect the speed of the alphabetic sort. I'll just leave it without the array for now, and put it in later when I'm bored.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 76 page(s) served in previous 5 minutes.

phpBB Created this page in 0.070669 seconds : 31 queries executed (52.5%): GZIP compression disabled