Re: Static vs. instance method: Which one performs better?
- From: "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx>
- Date: Fri, 29 Feb 2008 19:48:33 -0800 (PST)
On Mar 1, 3:35 am, gnewsgroup <gnewsgr...@xxxxxxxxx> wrote:
<snip>
I guess the task of the methods in the code above is too light to
yield any significant result.
Definitely. Even if there *were* a difference, you'd have to call a
method millions or even *hundreds* of millions of times to see it.
So, I am wondering, in general, if
there is a performance difference between a static method and an
instance method, assuming that they do exactly the same thing.
Anyone has an idea? Thank you.
In theory a static method might be very, very, *very* slightly faster
- there's no "this" parameter to pass.
However, this should never *ever* be the deciding factor in whether or
not to make a method static.
Jon
.
- Follow-Ups:
- Re: Static vs. instance method: Which one performs better?
- From: Rene
- Re: Static vs. instance method: Which one performs better?
- From: gnewsgroup
- Re: Static vs. instance method: Which one performs better?
- References:
- Static vs. instance method: Which one performs better?
- From: gnewsgroup
- Static vs. instance method: Which one performs better?
- Prev by Date: Static vs. instance method: Which one performs better?
- Next by Date: Re: Last row in foreach loop
- Previous by thread: Static vs. instance method: Which one performs better?
- Next by thread: Re: Static vs. instance method: Which one performs better?
- Index(es):
Relevant Pages
|