Benchmarking dynamic method invocation in .Net

Benchmarking method execution through interface, base class, virtual, override, dynamic, reflection and expression trees. In .Net there are many ways to execute a method. The fastest being the straight forward call to a static method. But how does its speed compare to other methods? There are countless reasons why we sometimes can’t just make a … Read more

sizeof() vs Marshal.SizeOf()

To get the size of a data type in .Net you can use   or  . I’ll briefly explain the difference between the two. sizeof()   (MSDN) can only be used on data types that have a known size at compile-time. It is compiled as a constant. If you attempt to use it on invalid … Read more

Speeding up Unitys Vector in lists/dictionaries

Introduction With this post I am digging into some performance improvements for Unity 3D’s Vector2, Vector3, Vector4 and Quaternion. The short version is that they really need   and can benefit from a better  . I’m demonstrating this with example of how it severely decreased performance in my project. Adding IEquatable<T> has no side-effects, if … Read more