I'm using read/write to read/write from/to local disk regular files.
I have to read/write small amount data. for example
read(fd, buf, 15)
write(fd, buf, 39);
And I was told that I should avoid small amount of data read/write when someone reviews my pull request.
They said: for example, I should allocate a large memory like 4k, and first copy the small data to the large memory, and write the large memory once instead of writing small data many times. And I should also read like 4k data once, and store it to big memory, then I can use that big memory.
But I understand that when I write small data, I write to page cache(?) so kernel will take care of the memory? When it's big enough, kernel will write to disk?
Am I understand right? Should I avoid read/write small data?