compare two arrays.

Byak@

Active Member
Licensed User
how can i fast compare two arrays?arrays have one and big(300000) langth.
i'm use
B4X:
diff=false
for i=0 to arraylen(arr1())-1
if arr1(i)<>arr2(i) then
diff=true
exit
end if
next
 

Byak@

Active Member
Licensed User
arrays have one and big(300000) length.
arrays have same count, i want compare elements.
i'm found a fast way (for arrays of bytes only)
B4X:
bitwise.new2(1252)
if strcompare(bitwise.bytestostring(arr1(),0,arraylen(arr1())),bitwise.bytestostring(arr2(),0,arraylen(arr2())))<>0 then diff=true
this code do at 30ms for arrays with 300000 elements



same

same​
 

nick2210

Member
pardon

Hi "Бяка".
I want to appoligize for trying to teach you as I had failed to notice your veteran's status at first.:sign0161:
 

Byak@

Active Member
Licensed User
Sarcasm?
a8ecb7c0915c.jpg
 

nick2210

Member
no sarcasm

No sarcasm at all.
I also hope that your line of code above will help me in better understanding the whole bitwise stuff.
P.S. Failed to send you a message via ICQ.:sign0089:
 

Byak@

Active Member
Licensed User
hmm...try again,maybe it is problem of my messenger...or send me PM with your ICQ =)
 

nick2210

Member
icq

Hi.
My icq number is 598513815.
Would you send me a "hi"?
I thought (from your nick) you were russian so I hope for better understanding.:)
So far I have no acquantance who is good in programming.
 
Top