There is a so-called "boxing" in C# - I think it is actually introduced in Java now. Basically, in C# some primitive types that map very well to CPU (ie int,long) are treated specially not like reference based objects, this allows to save memory and add some speed. I think in Java in v6 they moved to this concept as well.
Also generics in C# are better implemented to have very good performance because it is all checked at compile time so compiler gets pretty much native code, just the way generics (templates) are supposed to work.
Most of all I like pointers - you need to make special effort to use those, and I do very rarely, however in those cases I typically got 2 times higher performance from the same CPU intensive bit than when same code without pointers. 2 times is a lot - C# itself is very fast, but with pointers you can make real CPU intensive stuff fly.
Also generics in C# are better implemented to have very good performance because it is all checked at compile time so compiler gets pretty much native code, just the way generics (templates) are supposed to work.
Most of all I like pointers - you need to make special effort to use those, and I do very rarely, however in those cases I typically got 2 times higher performance from the same CPU intensive bit than when same code without pointers. 2 times is a lot - C# itself is very fast, but with pointers you can make real CPU intensive stuff fly.


Comment