BigUglySpider / EmuLibs

Selection of libraries designed to be used with Emu projects. This was originally a Math library only, but has since been changed to hold all Emu libraries to enable consistency in changes to dependencies (such as EmuCore modifications).
https://biguglyspider.github.io/math
0 stars 0 forks source link

FastVector4f #10

Closed BigUglySpider closed 3 years ago

BigUglySpider commented 3 years ago

Adds a FastVector type FastVector4f, which contains 4 floating-point elements, and makes use of SIMD intrinsic functions to optimise vector operations.

It should be noted that, although there is this explicit vector, a lot of optimisations may be performed by the compiler due to the inlined recursion of the base vector functionalities, so differences are not as drastic as one may expect. In the test harness, many functionalities tested close to one another, with SIMD winning by several milliseconds overall in all cases. These results should, however, be taken with a grain of salt as they do not directly consider live differences, as all operations are performed contiguously and thus there may be significantly less cache misses (as an example) than in a live environment.

Semantics with FastVector types are mostly identical to the base vector template, so choosing FastVector variants over the template will have minimal impact on code readability. Key differences include: