|
-
Jul 24th, 2012, 10:09 AM
#4
Thread Starter
New Member
Re: CRC32 - Fastest Implementation Available VB6
Joacim Andersson: sorry if I might have brought any confusion about this... i simply meant to state this is the fastest implementation of CRC32 in VB6 without the use of a third party dll/api written in another language. Also, you state that it is only slightly faster than some website that returns the result. You have to keep in mind, in order for me to get a time in ms I have to execute the CRC32 hash 10,000 times. So, basically in 15ms I can execute my CRC32 routine 10,000 times and its still faster than executing a CRC32 on a webserver one time. So, one operation of my CRC32 on the data "Hello World!" takes ~ 15ms/10,000 or 0.0015ms per operation! So, I would have to say 0.0015ms, or if converted from milliseconds to seconds it would be fifteen ten-millionths of a second, per hash, that is pretty damn fast for being in VB6 and not using a third party dll/api?
I don't understand how you can think that reading binary data from a resource file and changing the vtable before you can even start the execution of calculation wouldn't take much longer than to just start doing the CRC32 calculation against the data directly.
Answer: The vtable redirection and reading data from the resource file is only done on class_initialization, so its only done ONCE. Every call to the function is routed to the assembly code that is located in memory because the vtable contains the pointer already (which was done on class_initialize). So, its just as fast as calling the function normally. If that makes sense to you?
So, to finish my point, Joacim Andersson you stated that you looked over my code, but to be honest I think you skimmed over it at best. If you had looked over it and truely understood most of it then maybe you wouldn't have made these statements which were honestly wrong. Like you don't take my criticism to harshly , but your criticism is based on something you loosely understood and maybe thats my fault for not making my claim of speed more precise when I meant it was 25x to 100x faster than any other VB6 implementation. But, your claim about it only being slightly faster than some website's calculator is totally wrong, but I've already touched on that above.
However, it is indeed faster than the code outputted by the vb6 compiler. As far as optimizing goes, I did optimize it some... if you check out the CRC32_GENERATE_TABLE routine you will see that I unrolled the loop instead of writing a for loop in assembly. Also I tried my best to keep every operation contained to the general purpose registers and not use the stack or heap, but can it be optimized a little more? Sure it can!
dilettante: As far a DEP goes, you're correct in that DEP is designed to prevent such things. However, I'm not too worried about that as DEP is mostly implemented on newer 64-bit operating systems and VB6 is designed to run on a 32-bit processor. As far as it being 'detected' by anti-virus software, I highly doubt this because it is not using any apis that would cause any alarms to go off. RtlMoveMemory is what i'm using and because it only allows moving data from one local address to another local address then antivirus software doesn't care. It's looking for things such as CreateRemoteThread, WriteProcessMemory, OpenThread, SetWindowsHookEx, etc... etc..
Last edited by vbaddicts; Jul 24th, 2012 at 10:54 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|