Category "compiler-optimization"

How to avoid poorly optimized code for Fortran array pointers?

I get rather poorly optimized assembly with gfortran 11.2 when using array pointers, even in seemingly very simple cases. For example, the optimized code (https

How to turn on optimizations ( O3 ) when invoking cmake?

I am trying to build mlpack from source, So far I have compiled the library with the below command, cmake -G "MinGW Makefiles" -DBoost_INCLUDE_DIR="C:\msys64\mi

Which GCC optimization flags affect binary size the most?

I am developing a C++ for ARM using GCC. I have ran into an issue where, I no optimizations are enabled, I am unable to create a binary (ELF) for my code becau

Rapid stack allocations vs accessing a single heap allocation

I'm having a situation where I have an array T[] which must be copied in an instant and sent over to a function accepting a ReadOnlySpan<T>. I found two s

Passing an optimization flag to a Go compiler?

To compile a Go program you type go build myprogram.go, can you pass an optimization flags along or the code is always compiled in the same way? I am talking ab

Why don't compilers optimize trivial wrapper function pointers?

Consider the following code snippet #include <vector> #include <cstdlib> void __attribute__ ((noinline)) calculate1(double& a, int x) { a += x

Why are the results of the optimization on aliasing different for char* and std::string&?

void f1(int* count, char* str) { for (int i = 0; i < *count; ++i) str[i] = 0; } void f2(int* count, char8_t* str) { for (int i = 0; i < *count; ++i)

Pragmatics of typed intermediate languages

One trend in the compilation is to use typed intermediate languages. Haskell's ghc with its core intermediate language, a variant of System F-omega, is an examp

How do I see the time it took to run my program in Visual Studio Code?

Is there a way to see how long a script took to execute/complete in VS Code? I'm looking for a message like: Program finished in 30ms

How to remove "noise" from GCC/clang assembly output?

I want to inspect the assembly output of applying boost::variant in my code in order to see which intermediate calls are optimized away. When I compile the fol