Nibbles, bit operations and C dll's [RESOLVED]
In order to decode a file I must work with nibbles, so I have to do some byte shifting and-ing and or-ing. Because the files are large, around 10 Mb, speed really counts. I thought it would be faster if I could directly work on nibbles, but no such data type exists in VB. Could there be some way around? Btw I do the bit shifting by multiplying or dividing by powers of 2 as there's no shift operator as far as I know.
Re: Why is C faster than VB
Quote:
Originally Posted by Dave Sell
For pure string-parsing, nothing beats C, not even assembler.
I find this quite surprising not to say hard to believe. If c is so efficient at string parsing you'd only have to take the compiled c code and convert it to assembler, on the basis that each machine instruction corresponds to an actual assembler instruction... But my assembler days belong to the past and to the another computer architecture so I may overlook some of the facts.
Re: Why is C faster than VB
Quote:
Originally Posted by krtxmrtz
I find this quite surprising not to say hard to believe. If c is so efficient at string parsing you'd only have to take the compiled c code and convert it to assembler, on the basis that each machine instruction corresponds to an actual assembler instruction...
If you take a string parsing routine written in C, say a for loop using integer offsets to the base address of the string (array of bytes), and then decompile it to assembler, you will get about a 1-1 ratio of C code to assembler code. In other words, you may not get 1-line to 1-line correspondence, but you would not be able to reduce the assembler any further. C can be extremely close to assembler in terms of efficiency.
Re: Why is C faster than VB
Quote:
Originally Posted by Dave Sell
If you take a string parsing routine written in C, say a for loop using integer offsets to the base address of the string (array of bytes), and then decompile it to assembler, you will get about a 1-1 ratio of C code to assembler code. In other words, you may not get 1-line to 1-line correspondence, but you would not be able to reduce the assembler any further. C can be extremely close to assembler in terms of efficiency.
Oh I see what you mean, C is as efficient as assembler. I thought you meant assembler was less efficient than C, silly me !!! :blush: