Relative Content

Tag Archive for c++performance

Optimizing passing data between classes for processing in simulation, C#

I’m working on a simulation that will be running a certain operation upwards of hundreds of millions of times per frame, so performance in this loop is critical. I’m nearly at my performance target but I would like advice on if this is the best way, or there’s something I’m overlooking.

While Loop vs. Nested Method Performance in C#

In the code below, which method will be more performant as memory usage and CPU time? I tested performance, nested method is better for CPU time but couldn’t test memory usage (I don’t use nested methods like this, it will cause stack overflow exception, just wondering).

Reaching performance of unsafe_any_cast using only standard library features

I am using std::any to store a value of any type. std::any is a type-safe container and one of its features is that attempting to reach for the wrong type throws std::bad_any_cast exception. In some cases I can be sure that the stored type is the one I am trying to get, but I still have to go through std::any_cast which checks the stored type info and possibly throws an exception.