Jump to content

Combining multiple arrays...round 2


Cravin
 Share

Go to solution Solved by kylomas,

Recommended Posts

I just woke up in the middle of the night. Well I hope you get a good night's sleep. We still haven't done Combining Multilple Arrays...round 3 ... ;)

Still need to test the limitations of this method.

Interestingly I ran this with the code you changed vs the original that kylomas wrote and what I discovered is that your method uses more memory, but it actually seems to have reduced the time it takes to process by about 15~20% on a final array with about 170k elements.

 

Are you getting the same number of unique file names / duplicates with both methods or are these numbers different?

Edited by czardas
Link to comment
Share on other sites

Good news. This method handles full paths and more.

I could not determine the maximum possible length of a variable name. I ran out of memory before I hit the limit. This gets pretty interesting. The longest variable name I could properly test had a string length of 67108865 characters. The test below creates two variables with very long names and assigns each of them a value. They are then read and shown to be reliable.

;

#include <Array.au3>

Local $sAffix = "AA" ; The start of a very long string
While StringLen($sAffix) < 2^26 ; Reduce this number if you run out of memory
    $sAffix &= $sAffix
WEnd
ConsoleWrite(StringLen($sAffix) & @CRLF)

Local $tName, $iBound = 2 ; Increasing $iBound increases the number of variables

; Assign the variables
$tName = $sAffix
For $i = 0 To $iBound -1
    Assign($tName, $i, 2)
    $tName &= "A"
Next

Local $aShow[$iBound]

; Read the variables
$tName = $sAffix
For $i = 0 To $iBound -1
    $aShow[$i] = Eval($tName)
    $tName &= "A"
Next
_ArrayDisplay($aShow) ; Check that both values are different

;

Conversion to binary will therefore handle string lengths of up to at least 16777216 characters (2^26/4). While the limit has not been reached (by me at least), using this method for testing such long strings will most likely require the strings to be processed in chunks. Unless you work for someone like Cern, I don't think it will be a problem. :D

Edit oops: I didn't post all the code (sorry).

Edited by czardas
Link to comment
Share on other sites

Using ideas in this thread. I have created a function which allows you to input up to 24 zero based arrays. >LINK

I have run several tests and it seems to be working as expected. ==> Actually, I got the case sensitivity working the wrong way round, which has now been fixed. :whistle:

Edited by czardas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...