Raised This Month: $ Target: $400
 0% 

HUGE arrays


Post New Thread Reply   
 
Thread Tools Display Modes
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 01-22-2015 , 17:19   Re: HUGE arrays
Reply With Quote #11

Oh, okey.

I will play with this, and post here in case of any problems. Cheers!
LambdaLambda is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-22-2015 , 18:01   Re: HUGE arrays
Reply With Quote #12

Quote:
Originally Posted by m_bNightstalker View Post
I think you misunderstood what I'm trying to say. You have posted code from an older version of the timer, thats why I thought you "just" modify it.

Anyway, you should use ADT Arrays, so you need no MAX_CACHE and it's compiling faster.

You can sort those arrays to, thats not a problem. I had the same problem some days ago: https://forums.alliedmods.net/showthread.php?t=255581
Asherkin told me to use SortADTArrayCustom and it's working great.
I agree with you but since when we care about compiling time?
Mathias. is offline
m_bNightstalker
Senior Member
Join Date: Jan 2015
Location: JWD
Old 01-23-2015 , 02:02   Re: HUGE arrays
Reply With Quote #13

Quote:
Originally Posted by Black-Rabbit View Post
I agree with you but since when we care about compiling time?
Thats just a positive side effect, the main problem is your compiler will crash when your array is too big.

--->
Quote:
Originally Posted by LambdaLambda View Post
I've found that when I'm trying to compile plugin with variable that would have to handle 200000 different records, its crashing during compiling. 100000 does fine.

Last edited by m_bNightstalker; 01-23-2015 at 02:03.
m_bNightstalker is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-23-2015 , 02:09   Re: HUGE arrays
Reply With Quote #14

oh gotcha, my bad
Mathias. is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 01-24-2015 , 10:23   Re: HUGE arrays
Reply With Quote #15

Wait, but with usage of adt_array you still got to declare it's matrix. So I don't really these advantages.
LambdaLambda is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-24-2015 , 13:41   Re: HUGE arrays
Reply With Quote #16

you supose to know your structure size, it the amount if index that is dynamic
Mathias. is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 01-24-2015 , 13:46   Re: HUGE arrays
Reply With Quote #17

The inner block size of the adt_array needs to be specified, but the number of elements inside it doesn't need to be known.

For example, suppose I want an array to store a bunch of strings. I don't know how many strings there will be, but I will know that each of them will be < 200 characters in length. Therefore, I can shove in as many strings as I want into the adt_array (up to the RAM limit of course) as long as they are < 200 characters in length.

If they are > 200 characters, it's truncated to 200.

So this:

PHP Code:
new String:Names[100][200]; 
means I can only store 100 strings in it, and each can at most have 200 letters in them.

This:

PHP Code:
new Handle:Names CreateArray(200); 
means I can store as many strings as I want (no limit, whereas prior to that I had a limit of 100), but only strings that are <= length 200 only (anything > 200 is truncated to 200 characters).

Of course, you can set the block size to some arbitrarily big number that you will never hit to have pseudo-totally-dynamic arrays.

Last edited by Potato Uno; 01-24-2015 at 13:48.
Potato Uno is offline
m_bNightstalker
Senior Member
Join Date: Jan 2015
Location: JWD
Old 01-25-2015 , 04:00   Re: HUGE arrays
Reply With Quote #18

Quote:
Originally Posted by LambdaLambda View Post
Wait, but with usage of adt_array you still got to declare it's matrix. So I don't really these advantages.
I've posted already a working example, olny the sorting part is missing:
https://forums.alliedmods.net/showthread.php?t=255581
m_bNightstalker is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 01-25-2015 , 14:47   Re: HUGE arrays
Reply With Quote #19

Your example requires matrix declaration. The difference between these then is only the way you access to that data.

Last edited by LambdaLambda; 01-25-2015 at 14:48.
LambdaLambda is offline
ClassicGuzzi
Veteran Member
Join Date: Oct 2013
Location: Argentina
Old 01-25-2015 , 18:13   Re: HUGE arrays
Reply With Quote #20

Why don't you just use queries to the database? I mean you could get the info in any way you want and sorted, plus if you make threaded sql queries, it won't lag the server (if you have a lot of people on your database).
ClassicGuzzi 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 22:55.


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