Live data from Hacker News

Benchmark: C++ vs C#

codeproject.com

31–36 of 36 posts

Re: Benchmark: C++ vs C#

#31
post #5

The benchmark numbers for the Compact Framework on ARM make this a lot more interesting. I used it on PowerPC (the XBox 360 .NET runtime used by XNA is based on the Compact Framework), and I was uncertain whether the issues were related to the PowerPC architecture. It looks like the Compact Framework is just bad.

I wonder if this is the same thing that's used in WP7. Bad news if it is, I guess...

The compact framework has traditionally been horrible and kind of a joke. I hope MS has either ported the proper .NET framework or greatly improved the compact framework for WP7, if not it makes the choice of no native code support even worse.

Re: Benchmark: C++ vs C#

#32

This benchmark is totally wrong as you can read in the comments of the page. Basically he didn't turn on all optimizations on the C++ program and used the "slow but secure" version of the Microsoft STL. Also his GenericSum uses array in C++ and lists in C#, so the C++ has to reallocate at each append. I could go on for long, I appreciate the intent, but all you need to know is that Microsoft gave up on using C# every…

>I could go on for long, I appreciate the intent, but all you need to know is that Microsoft gave up on using C# everywhere because it's damn too slow.

As a data point, a friend of mine works for Microsoft on one of the Blend products. He's using C# for at least some of his work.

Re: Benchmark: C++ vs C#

#33

I think he hit the nail on the head referring to c# programmers in general not being as "performance conscious" which leads the misconception that c# is a much slower language to use. I've worked in many places and have come across the same thing. As a c++ programmer I have also worked with c# coders and am often shocked at their slap-dash approach to software engineering. I'm not saying they're all like that but it…

Maybe that's true, but I'm working on a Windows Phone 7 app right now that struggling to hit its performance targets. The major culprit? Silverlight's data-binding. Microsoft shipped the framework without shipping high performance controls necessary to meet the certification requirements of their app store (ListBox, I'm looking at you), so while our code might return the results of the list in <20ms, it takes another…

Have you tried using the virtualizing listbox?

Re: Benchmark: C++ vs C#

#34
post #33

Earlier quoted context omitted.

Maybe that's true, but I'm working on a Windows Phone 7 app right now that struggling to hit its performance targets. The major culprit? Silverlight's data-binding. Microsoft shipped the framework without shipping high performance controls necessary to meet the certification requirements of their app store (ListBox, I'm looking at you), so while our code might return the results of the list in <20ms, it takes another…

Have you tried using the virtualizing listbox?

From my research, it looks like the Listbox enables UI virtualization by default. It didn't help. I ended up finding some helpful soul's NavigationListControl and limiting the number of results until the user taps a "show all" button. It helped a little. I think the final solution will be pre-allocating the first N data items with empty strings so that the initial cost of the Listbox is incurred at initial-page-layout-time rather than at keypress-time.

Re: Benchmark: C++ vs C#

#35
post #33

Earlier quoted context omitted.

Have you tried using the virtualizing listbox?

From my research, it looks like the Listbox enables UI virtualization by default. It didn't help. I ended up finding some helpful soul's NavigationListControl and limiting the number of results until the user taps a "show all" button. It helped a little. I think the final solution will be pre-allocating the first N data items with empty strings so that the initial cost of the Listbox is incurred at initial-page-layou…

I was solving similar problem but with a datagrid. I ended up adding my own scrollbar (so that I have better knowledge of what to preload) and populating the datagrid with an array of references to a single "Loading" object. The reduction in allocations sped it up a lot as well, I guess.

Re: Benchmark: C++ vs C#

#36
post #29

This benchmark is totally wrong as you can read in the comments of the page. Basically he didn't turn on all optimizations on the C++ program and used the "slow but secure" version of the Microsoft STL. Also his GenericSum uses array in C++ and lists in C#, so the C++ has to reallocate at each append. I could go on for long, I appreciate the intent, but all you need to know is that Microsoft gave up on using C# every…

>> but all you need to know is that Microsoft gave up on using C# everywhere because it's damn too slow. Got any proof of that?

When they started Vista they wanted to go .NET all the way and had to go back using more native code.
Post reply on HN