Once upon a time i was diving on SFML 2.3.1 source code and i found the image loading function and i saw the std::vector usage for holding bytes of image. I think that std::vector must be replaced with somothing else
because the std::vector works like that: when user calls push_back, it causes:
1.)the old data becomes buffer that holds previous values;
2.)than he creates new memory (calls new[size wich is 1 more bigger than previous]), that is empty,
3.) than he fills new memory with buffer's data, than removes the buffer from memory,
4.)and than initilizates the new, empty element of new memory with value that was an argument for push_back() function.
speeking shortly: the std::vector::push_back() function causes the hard allocation and dellocation of memory process. And as we know most of images have in average 1000 bytes inside (or more)!
Example: that std::vector allocates
new 1000 bytes in memory than fills it from buffer that has (logically) 999 bytes with which it
Fills the new memory(as i know it fills new memory with some kind of loop, maybe
for(...){}
) than removes the buffer(removes
999 bytes!) and than initilizates the new element with push_back() function argument.
Sounds terrible!!!