Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crc32
Message
From
25/08/2011 06:02:47
 
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Re: Crc32
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01521077
Message ID:
01521742
Views:
33
>Boy you've really dived into this one :-}

Oh yes. There are times something invades my brain so intensely , I cannot think of anything else

The biggest problem I had was to merge the (partial) CRCs. All I could find that you can xor them, eg

crc(0x12345678) = crc(0x12000000) xor crc(0x340000) xor (0x5600) xor (0x78)

But I only had crc(0x12), crc(0x34), crc(0x56) and crc(0x78)

So there was a function to be found: Shift(crc, numberOfBytes)

It then becomes something like

crc(0x12345678) = Shift(crc(0x12), 3) xor Shift(crc(0x34)), 2) xor Shift(crc(0x56), 1) xor crc(0x78)

>Want to try it when I get the time.

Please do. I would love to improve the speed further using some kind of parallelism. Have looked ( not tested) at patterns other than the Parallel.For() but did not find anything better

I have also tried to read the file using BeginRead() and EndRead(). But just using those (no crc calculation) took a bit over one second. So, I abandonned that route


>At first I assumed you had hard-wired the buffer count to your machine specs but I see you're doing it dynamically based on the environment....
>

The thing that strikes me is that I had to multiply the buffers by 8 to achieve a better kind of parallel processing. The first test with 4 or 8 buffers was, to say the least, disappointing
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform