Re: c# static constructor?
- From: "ms news group" <noret@xxxxxxxxx>
- Date: Fri, 4 May 2007 17:16:32 +0800
I am not misunderstanding the article, and the code example given is too
simple for me to reproduce with any difference.
In the very classical example (very tight loop), they say the static
construtor code should be eight times slower, but I see no siginificant
difference at all.
Jon Skeet said, ".net 2.0 optimized it a bit". But, by comparing the result
given by the article, and my result, it's understatement by saying 'a bit."
"Oliver Sturm [MVP C#]" <oliver@xxxxxxxxxxxx> wrote in message
news:diukdt5p8ih4.dlg@xxxxxxxxxxxxxxx
Hi,But
ms news group wrote:
I read one article that says static constructor can be a big performance
hit, it even gives some code fragment, which, accoring to that article,
could show a big difference betweeen using static constructor or not.
whichwhen I run his code, I found no significant diifference at all.
Then you're either misunderstanding the article or the environment in
you are running your test is not the same that the author of the articleand
was using.
Could someone shed some light on this?
Shed some light on what? Static constructors make an important bit of
functionality available to C# programmers. If you need that functionality,
use them. If not, don't. I've used countless static constructors myself
I wouldn't stop doing so unless I encounter a scenario where it is clear
that they are not working for me. And even then I'd suspect that the
behaviour in question would rather be a bug than a design feature.
Oliver Sturm
--
http://www.sturmnet.org/blog - MVP C#
.
- Follow-Ups:
- Re: c# static constructor?
- From: Oliver Sturm [MVP C#]
- Re: c# static constructor?
- From: Jon Skeet [C# MVP]
- Re: c# static constructor?
- References:
- c# static constructor?
- From: ms news group
- Re: c# static constructor?
- From: Oliver Sturm [MVP C#]
- c# static constructor?
- Prev by Date: Re: c# static constructor?
- Next by Date: Re: c# static constructor?
- Previous by thread: Re: c# static constructor?
- Next by thread: Re: c# static constructor?
- Index(es):
Relevant Pages
|
Loading