When trying to access GL_ARRAY_BUFFER using glBufferSubData to 128 byte buffer size, accessing takes at worst 200 microseconds. Instead when allocating whole buffer again with glBufferData it takes only 3 microseconds. I had similar issues with glGetBufferSubData. My CPU is i5 8600k and gpu is gtx 1080 ti
glBufferData(GL_ARRAY_BUFFER, sizeof(mat4) * 2, matrices.data(), GL_DYNAMIC_DRAW); // 3 us
glBufferSubData(GL_ARRAY_BUFFER, sizeof(mat4) * index, sizeof(mat4), matrix.data()); // at worst 200 us
using namespace std::chrono;
// same measurement for both cases
auto timer = high_resolution_clock::now();
glBufferData(GL_ARRAY_BUFFER, sizeof(mat4) * 2, matrices.data(), GL_DYNAMIC_DRAW);
std::cout << duration_cast<microseconds>(high_resolution_clock::now() - timer).count() << '\n';