Opened 7 years ago
Closed 4 years ago
#11458 closed Patches (obsolete)
Performance improvement in boost/math.quaternion.hpp
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | math |
Version: | Boost 1.58.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
Quaternion makes use of std::valarray
to make some trivial math operations take fewer LOC to implemen. valarray
always mallocs, even for a small number of values, in this case 2 or 4. This has a huge performance impact on quaternion division. In an model I am working on, replacing the use of valarray
with a normal stack array resulted in a 32% performance improvement. As the changes are not hard to implement and rely on no special libraries, I believe that the boost library can benefit from these changes.
I've attached a modified header to this that should fix the issue, but do not have time or resources to fully test it for boost inclusion. I've done my best to emulate your style, but I assume someone will want things done slightly differently.
Attachments (1)
Change History (3)
by , 7 years ago
Attachment: | quaternion.hpp added |
---|
comment:1 by , 7 years ago
Although this issue is about the heap alloc, it seems that Intel has made a valarrray using SIMD instructions. That could be the next improvement:
https://software.intel.com/en-us/node/514490.
Perhaps a valarray with static sizes could in itself be a good addition to Boost (in Boost.Container, but this probably this spawns a heated modularization discussion).
comment:2 by , 4 years ago
Resolution: | → obsolete |
---|---|
Status: | new → closed |
Current version no longer uses valarray.
editted header