Relative Content

Tag Archive for c++performance

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Local variables performance vs global in example

I study performance of C code. OS is Windows 10.
Suddenly I found that the same code runs 2x faster if I use local variables against the same code with global variables.
I can’t understand why. Tested both in Visual Studio and GCC. Same performance difference.
The test results:

Accessing pointer fields through properties

Is it possible to avoid overhead of property-method call in this case (somehow forcing compiler inline? I know this more like an Alias but there is no such thing in C#):