Hello,
since value types don't have to be dereferenced, they're supposed to be
faster than reference types (exceptions aside). To prove this, I developed a
testprg in VB and to my surprise and the opposite proofed! I looked at the
IML-Code and noticed, that the VB-compiler "invented" an other (third) value
type object, even if I only used two value types in the sample. I then did
the same in C#, and the IML-code was perfect.
So my questions are:
a) Does anybody know about a "weird" behaviour with value types of the
vb.compiler?
b) (Has nothing to do with this, just another question): Can I assume that a
value type is usually to be accessed quicker, since the probability that it
is already hosted in a processor cache is higher than with referece types
(at least if a program cosumes large amount of space)?
If you want to have the samples for testing, simply mail me to
testaccount01 at loeffelmann dot de
Klaus
Mattias Sj?gren - 26 Nov 2003 11:55 GMT
Klaus,
>a) Does anybody know about a "weird" behaviour with value types of the
>vb.compiler?
I'm not sure what the weird behavior is that you're describing. It
would be a lot easier to comment of you posted relevant parts of the
code here. Did you do an optimized build?
>b) (Has nothing to do with this, just another question): Can I assume that a
>value type is usually to be accessed quicker, since the probability that it
>is already hosted in a processor cache is higher than with referece types
>(at least if a program cosumes large amount of space)?
You may want to post that to the .performance newsgroup.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Matthew W. Jackson - 08 Dec 2003 05:34 GMT
I'm guessing that it has something to do with VB's loose type-safety.
Try adding "Option Strict" and compile the code again. I know that VB
without Option Strict can write refleciton-code to do late-binding, so the
results you are seeing may be as a result of that feature.
It has been my experience that VB with Option Strict should produce similar
IL code to C#, but I've never investigated the matter myself.
--Matthew W. Jackson
> Hello,
>
[quoted text clipped - 18 lines]
>
> Klaus