Re: Why is C# 450% slower than C++ on nested loops ??
- From: "Peter Olcott" <olcott@xxxxxxx>
- Date: Thu, 29 Dec 2005 12:26:58 -0600
"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:%23dZslfIDGHA.3844@xxxxxxxxxxxxxxxxxxxxxxx
>
> "Christoph Nahr" <christoph.nahr@xxxxxxxxxxxxx> wrote in message
> news:j4c7r1hvc5lcrmfkndto2724bsnrqe8rk5@xxxxxxxxxx
>> On Thu, 29 Dec 2005 00:19:33 +0100, "Willy Denoyette [MVP]"
>> <willy.denoyette@xxxxxxxxxx> wrote:
>>
>>>[1] This is the correct code which is still ~50% slower than the (corrected)
>>>native C++ code ( __int64 x=0;).
>>
>> Great analysis! This 50% slowdown is also what I've observed in other
>> (non-broken...) mathematical benchmarks of C# vs native C++.
>>
>> For the record, that's also the maximum performance loss I've ever
>> observed; in tasks that aren't as well suited to modern C++
>> optimizers the speed difference is only about 10-20%.
>> --
>
> In this "particular" case, one could conclude that the C# team could have done
> a beter job. However, when looking at the IL produced by C++/CLI and C# you'll
> see that all three produce identical IL (or the loop construct), so there is
> no reason to blame C#.
> However, despite the fact that all managed compilers produce the same IL they
> perform differently:
According to MS technical support this is incorrect. The only reason that one
compiler produces faster code than another is that they generate different CIL.
>
> Same IL
> C#: 100% (verifiable)
> C++/CLI /clr: 64% (non-verifiable)
> C++/CLI /clr:safe : 120% (verifiable)
>
> native C++ : 62%
>
> So you see that in this 'particular case', managed code can perform like
> native code and C# performs slightly better than managed safe C++, but is this
> true in all cases? NO sure not. And that's why you should be careful when
> interpreting benchmark figures, most of the time they have no real value and
> sometimes they are (in a subtle way) incorrect
>
>
> Willy.
>
>
.
- References:
- Why is C# 450% slower than C++ on nested loops ??
- From: Peter Olcott
- Re: Why is C# 450% slower than C++ on nested loops ??
- From: Willy Denoyette [MVP]
- Re: Why is C# 450% slower than C++ on nested loops ??
- From: Christoph Nahr
- Re: Why is C# 450% slower than C++ on nested loops ??
- From: Willy Denoyette [MVP]
- Why is C# 450% slower than C++ on nested loops ??
- Prev by Date: Re: Why is C# 450% slower than C++ on nested loops ??
- Next by Date: Listbox question
- Previous by thread: Re: Why is C# 450% slower than C++ on nested loops ??
- Next by thread: Re: Why is C# 450% slower than C++ on nested loops ??
- Index(es):
Relevant Pages
|