|
Effective max size of arrays
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Fletchling
Australia (54 posts) bio
|
| Date |
Fri 31 Mar 2006 10:12 AM (UTC) [ quote
] |
| Message |
G'day
I have an idea I'd like to try for my mud, but it involves a bunch of arrays of about a 1000 keys each. Any ideas on how I'd measure the performance impact?
In fact, ideas on how I should ask the question (I don't know what I don't know) is probably a better question.
Fletchling | top |
|
| Posted by |
David Haley
USA (3,881 posts) bio
Moderator |
| Date |
Reply #1 on Fri 31 Mar 2006 04:58 PM (UTC) [ quote
] |
| Message |
I'm not sure how much a "bunch" is, nor exactly what you plan on doing with the arrays, but several thousand keys shouldn't be a problem.
What matter are things like how many times you loop over the entire array, if you're just doing key lookups, what scripting language you choose, etc. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
| Posted by |
Fletchling
Australia (54 posts) bio
|
| Date |
Reply #2 on Fri 31 Mar 2006 10:55 PM (UTC) [ quote
] |
| Message |
bunch = metric term for lots
script language = Lua (I'm sold on Lua)
no loops interrogating each array, just a serial read of each key and value, then some small processing for display formatting. Since the outcome is informational, that is I'm at a point in the mud where I want to make decisions, not millisecond client response, I'm happy with the whole operation taking a second or two.
I was more worried whether there was an overhead to MC just by having a bunch* of arrays. If the pilot works to the satisfaction of my captive bug tester, the arrays may be extended to max size of 10k elements.
Oh, the purpose of this is to explore possibilities for mapping, but that topic has been beaten to death elsewhere so I thought to keep this post to just the code related issues.
*see above definition | top |
|
| Posted by |
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator |
| Date |
Reply #3 on Sat 01 Apr 2006 05:52 AM (UTC) [ quote
] |
| Message |
As Ksilyan says, the important thing is not having them but what you do with them. It is not so much whether MUSHclient will be slow, as whether Lua can handle it, and I would suggest that unless you are accessing millions of items a second, yes it will.
You could write a small test script in the immediate window, making as many table items as you expect (with random or fixed data) and then iterate through it and see how long whatever you are planning to do, takes. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
David Haley
USA (3,881 posts) bio
Moderator |
| Date |
Reply #4 on Tue 04 Apr 2006 07:22 AM (UTC) [ quote
] |
| Message |
Everything Nick said holds; there's also another small consideration which is memory. If you're storing, say, a million keys, each pointing to an integer, you'll be using at least four megabytes of memory (if not in fact more like eight). Like I said, though, that's a fairly small consideration, because four or eight (or even twenty) really isn't a whole lot of memory.
But as Nick said, the best way to find out for sure is simply to run the script and see what happens. I suspect it won't be too bad, and I doubt it'll take a whole second, but again that depends on what exactly is being done to the data. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
| Posted by |
Fletchling
Australia (54 posts) bio
|
| Date |
Reply #5 on Tue 04 Apr 2006 11:57 PM (UTC) [ quote
] |
| Message |
It's all true.
I created an array bigger than I can count and MC didn't blink. If the result of this work actually looks any good from a mud player's perspective, I'll post the purpose, method and outcome. First of all I have to get it past the captive bug-tester girl.
Thanks guys.
[doffs 'is 'at] | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
1,859 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )