In what ways do C++ exceptions slow down code when there are no exceptions thown?

There is a cost associated with exception handling on some platforms and with some compilers. Namely, Visual Studio, when building a 32-bit target, will register a handler in every function that has local variables with non-trivial destructor. Basically, it sets up a try/finally handler. The other technique, employed by gcc and Visual Studio targeting 64-bits, … Read more

Overhead of a .NET array?

Here’s a slightly neater (IMO) short but complete program to demonstrate the same thing: using System; class Test { const int Size = 100000; static void Main() { object[] array = new object[Size]; long initialMemory = GC.GetTotalMemory(true); for (int i = 0; i < Size; i++) { array[i] = new string[0]; } long finalMemory = … Read more