Sunday, March 27, 2011

Is there performance penalty on managed code when reading/writing high data volume on TCP/UDP socket compare to unmanaged code?

Do you think C# TCP/UDP socket use in the managed application can handle (roughly) same amount of data as native C++ version? If not, what is data amount we shall consider native or c# is better to use and what is the biggest obstacle in the implementation on managed side?

From stackoverflow
  • It is my experience that the network speed and latency are bigger factors in regards to performance than managed or unmanaged code. Actually that is the same in regards to database access.

  • The answer must depend, to some extent, on the hardware.

    I suggest that you write little prototype programs, to experiment.

  • Both can handle the same amount of data. The question is speed and memory use. C# has proven itself negligibly slower in most scenarios: so there is no reason not to use it. There are a couple of memory implications when using C# for sockets (mainly, a lot of pinning occurs which will fragment your heap). The most important thing to get right is documented here. If the link is broken (isn't working my side but maybe that is our dodgy internet) Google has it cached.

0 comments:

Post a Comment