Boost::multi_array performance question

前端 未结 16 2132
不思量自难忘°
不思量自难忘° 2020-12-04 11:20

I am trying to compare the performance of boost::multi_array to native dynamically allocated arrays, with the following test program:

#include 

        
16条回答
  •  不思量自难忘°
    2020-12-04 12:13

    I am wondering two things:

    1) bounds check: define the BOOST_DISABLE_ASSERTS preprocessor macro prior to including multi_array.hpp in your application. This turns off bound checking. not sure if this this is disables when NDEBUG is.

    2) base index: MultiArray can index arrays from bases different from 0. That means that multi_array stores a base number (in each dimension) and uses a more complicated formula to obtain the exact location in memory, I am wondering if it is all about that.

    Otherwise I don't understand why multiarray should be slower than C-arrays.

提交回复
热议问题