# Acceleration of Particle Swarm Optimization with AVX Instructions
## 4 Conclusions  
We tested the performance of a parallel CPU-based implementation of the PSO algorithm. Our goal was to compare the impact of AVX instructions on the execution speed.  
We assessed the performance of four versions of PSO implemented in C++ programming language. All versions were optimized for the target architecture and used the same code, except for the crucial part of the PSO computation.  
The results confirm that the best-performing version uses assembly code. Similar performance was achieved by the more independent code programmed with AVX intrinsics, which resulted in only a slight performance decrease compared to the assembly code. The code optimized just by the auto-vectorization capability of the compiler suffers from another reduction in performance but still vastly outperforms the scalar version of PSO.  
In other words, automatic compiler vectorization creates fast parallel code. This approach combines the benefits of rapid development without using any AVX-specific instructions. There are still some limitations and specific requirements on the source code affecting vectorization by the compiler.  
The most suitable approach for increasing code performance involves AVX intrinsics. The final assembly code was almost identical to the Asmavx version and provided better performance than the Avavx version.  
Asmavx code benefits from the problems usually caused by high dimensions and big swarms--providing further performance gains because of its low-level nature and other assembly tweaks. On the other hand, there are higher requirements for programmers, maintenance, portability and development time than for the previous versions.  
We generally achieved about two times faster code using vectorization instead of the simple scalar version. The overall performance gain affects several factors. Not all code can be parallel, and we vectorized only the crucial part of PSO computation. The PSO algorithm's performance depends significantly on the test function used. As the test function varies or is unknown for real-world problems, we oriented the optimizations only toward the core of the PSO algorithm.  
The results suggest that the use of auto-vectorization brings significant improvement in performance without further requirements on developers. The code is competitive with intrinsic and assembler versions. The performance gain became helpful for various real-world applications and should be used as default settings. However, to fully utilize the  
Figure 3: Runtime performance of PSO, benchmark suite—Asmavx vs. Intavx.  
AVX performance in complex computations, optimization by using intrinsic or assembler instructions is still required.  
Conceptualization, [PERSON] and V.S.; methodology, J.S. and V.S.; software, J.S.; validation, [PERSON]; formal analysis, [PERSON]; writing--original draft preparation, [PERSON]; writing--review and editing, [PERSON] and V.S.; visualization, [PERSON]; supervision, [PERSON]; funding acquisition, [PERSON] All authors have read and agreed to the published version of the manuscript.  
This work was supported by the European Regional Development Fund under the project AI&Reasoning (reg. no. CZ.02.1.01/0.0/0.0/15 003/0000466).  
The authors declare no conflict of interest.