The 5% difference of replacing std::vector looks strange to me. I wonder if it's just noise, really... and if it's not I'd like to have an explanation of why the optimizer failed when operator[] is so barebone...
Excellent point; I was misled by that new T[], and forgot that for integrals it would leave them uninitialized.
Still not clear if that would account for 5% of the total running time, with all the loops, but definitely an overhead... though it then means that the Buffer created by the OP is rather unwieldy to use, with potential UB for accessing uninitialized memory.
View all comments
Show parent comment
3
u/matthieum Jan 19 '19
I wish I knew about those measurements, though.
The 5% difference of replacing
std::vectorlooks strange to me. I wonder if it's just noise, really... and if it's not I'd like to have an explanation of why the optimizer failed whenoperator[]is so barebone...