From: Jim Balson on
Tony Johansson wrote:
> Hello!
>
> I just wonder what is the difference in processing speed between using an
> array of ints and an array of byte if the array
> is very large.
>
> //Tony
>
>


I have come to believe that array processing in C# is just plain slow
because of bounds checking, along with other factors. If you take 2
different algorithms, say bubble sort, and prime number generation and
write them is C/C++ and then C#, you wil lsee that the C/C++
implementation of bubble sort is roughly 3x faster than the C# version.
However, if you take a compute intensive algorithm lie prime number
generation, the C++ version is now only less than 1x slower than the C++
version.

Look at the following for more details:

http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf


Hope this helps.


Jim



From: kndg on
On 3/24/2010 3:47 AM, Jim Balson wrote:
> Tony Johansson wrote:
>> Hello!
>>
>> I just wonder what is the difference in processing speed between using an
>> array of ints and an array of byte if the array
>> is very large.
>>
>> //Tony
>>
>>
>
>
> I have come to believe that array processing in C# is just plain slow
> because of bounds checking, along with other factors. If you take 2
> different algorithms, say bubble sort, and prime number generation and
> write them is C/C++ and then C#, you wil lsee that the C/C++
> implementation of bubble sort is roughly 3x faster than the C# version.
> However, if you take a compute intensive algorithm lie prime number
> generation, the C++ version is now only less than 1x slower than the C++
> version.
>
> Look at the following for more details:
>
> http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf
>

Hi Jim,

Array bound checking is a very good feature which improve safety and
avoid the nasty buffer overrun bugs found in old c/c++ programs and I
don't think it would give a significant impact on the performance. The
article you mentioned above also quite suspicious. I don't think a C#
program would perform very badly compared to Java. So, I did a quick
test. I haven't read the whole article, so I pick the simplest algorithm
- BubbleSort. On my system 2GHz, 2GB laptop (which is under spec
compared to their machine), I get the following result:

C#: 65 seconds
Java: 130 seconds

Which is quite the reverse and nearly match the c/c++ performance.
Probably, there is something wrong with their implementation...

Regards.
 | 
Pages: 1
Prev: SSH
Next: moniter network usage on the network