sunshaking's blog. computer graphics.
Monday, January 18, 2016
vector::operator  is time consuming
I am handling large amount of data (4000*4000 double). I found vector::operator  is really expensive in terms of CPU cost.
arr = AllocateArray(4000, 4000);
arr[i] = x; // it's extremely slow.
So avoid of using operator , instead, use direct address of the buffer could improve the performance tremendously:
double * buffer_addr = &arr;
Loïc Xueqing Sun
Links to this post