[Mono-list] VBNC in Mono.
Rolf Bjarne Kvinge
rolflists at ya.com
Thu Sep 14 14:13:56 EDT 2006
On Thu, 14 Sep 2006 17:22:34 +0200, Jonathan Gilbert
<2a5gjx302 at sneakemail.com> wrote:
> In the case of an Object that is known to contain a String, a call to
> .ToString() may perform better than a direct cast. A cast still needs to
> check the type, even though the code has already just done it with a
> (I'd be very surprised if the JIT can detect that pattern and only do one
> check). Calling .ToString() will be a virtual call to "return this;".
> be interesting to do a comparison, but my intuition is that .ToString()
> would be significantly faster in this case.
Just tried it, but I got inconclusive results (sometimes .ToString()
performed better, sometimes DirectCast performed better). During the first
test runs .ToString() did perform better (5-10% better), then suddenly
DirectCast started performed better (5-20% better), so I don't really
think there is any big difference. I tried running with and without
debugger, DEBUG and RELEASE builds, and with and without integer checks
on, and always got inconclusive results (only on MS, I don't know how Mono
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.3/447 - Release Date: 13/09/2006
More information about the Mono-list