Fastes way to compare 2 big arrays

Posted on 2009-12-30
Last Modified: 2012-05-08

I have 2 bytearrays, they are very big (6MB). I want to compare them and save the differences into a new Bytearray. If nothing is changing, I put 0.

So I want to compare them, if there is a difference, I'll take the value of the bytearray 2, if not, I take value 0

I can loop through the Array but thats not really fast.

Heard something about bitshifting?


Question by:Ruttensoft
    LVL 22

    Accepted Solution

    LVL 9

    Expert Comment


    I think you have to traverse the lists to compare the data. Actually 6MB is not so big as you think, and you can break right away when you find difference between the array. I bet the full operation will be finished in 0.01 secs.  Hope this can help you. (The articles that mroonal provided also prove this).

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now