When we need to fill std::vector with values and the size of vector is known in advance, there are two possibilities: using emplace_back() or using operator. For the emplace_back() we should reserve the necessary amount of space with reserve() before emplacing into vector. This will avoid unnecessary vector regrow and benefit performance. Alternatively, if we…
All posts tagged vectorization
When an instruction depends on the previous instruction depends on the previous instructions… : long instruction dependency chains and performance
In this post we investigate long dependency chains: when an instruction depends on the previous instruction depends on the previous instruction… We want to see how long dependency chains lower CPU performance, and we want to measure the effect of interleaving two dependency chains (by interleaving two operations) reflects on software performance. Operations with long…
The memory subsystem from the viewpoint of software: how memory subsystem affects software performance 2/3
We continue the investigation from the previous post, trying to measure how the memory subsystem affects software performance. We write small programs (kernels) to quantify the effects of cache line, memory latency, TLB cache, cache conflicts, vectorization and branch prediction.
Memory consumption, dataset size and performance: how does it all relate?
We investigate how memory consumption, dataset size and software performance correlate…
Vectorization, dependencies and outer loop vectorization: if you can’t beat them, join them
As I already mentioned in earlier posts, vectorization is the holy grail of software optimizations: if your hot loop is efficiently vectorized, it is pretty much running at fastest possible speed. So, it is definitely a goal worth pursuing, under two assumptions: (1) that your code has a hardware-friendly memory access pattern1 and (2) that…
Making your program run faster: the key concepts of software performance
In this post we present key concepts of software performance engineering.
When vectorization hits the memory wall: investigating the AVX2 memory gather instruction
For all the engineers who like to tinker with software performance, vectorization is the holy grail: if it vectorizes, this means that it runs faster. Unfortunately, many times this is not the case, and the results of forcing vectorization by any means can mean lower performance. This happens when vectorization hits the memory wall: although…
Loop Optimizations: taking matters into your hands
We try to answer two questions related to compiler optimizations: how can you help the compiler do a better job and when does it make sense to do the compiler optimizations manually.
Loop Optimizations: how does the compiler do it?
We investigate what are the techniques your compiler employs to make your loop run faster.
CPU Dispatching: Make your code both portable and fast
CPU dispatchingh is all about making your code portable and fast. We will talk about how to make your detect features your CPU has at is disposal and select the fastest function for that particular CPU without a need to recompile your software.