optimize to help compiler reduces accesses to simple arithmetic
Opened this issue · 0 comments
Branch: develop
Currently, pawn::array_view
duplicates the entire indirection table and stores it in std::vector
for arrays with variable dimensions. The compiler does pretty good optimization for arrays whose size are already known but for obvious reasons, the compiler won't reduce the array views with dimension sizes which are obtained at runtime to arithmetic instructions. A hand-written code can clearly be much more efficient than pawn::array_view
in such cases.
Solution 1:
Get rid of the container like features such as iterators, bounds checking, etc. in exchange for allowing the creation of optimizable temporaries in operator[]
. This, of course, kills many of the features while performing as fast as hand written code.
Solution 2:
Ban the use of variable size dimensions and force users to provide a maximum size for the dimension size.
This solution is so bad that it shouldn't even be taken seriously.