阅读背景:

std :: vector的性能不好是因为没有调用realloc的对数次?

来源:互联网 

EDIT: I added two more benchmarks, to compare the use of realloc with the C array and of reserve() with the std::vector. From the last analysis it seems that realloc influences a lot, even if called only 30 times. Checking the documentation I guess this is due to the fact that realloc can return a completely new pointer, copying the old one. To complete the scenario I also added the code and graph for allocating completely the array during the initialisation. The difference from I added two more benchmarks, to compare t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: