> My suggestion would be to avoid adding not required lines to that buffer That's a lot of complication and potential for bugs for an obscure performance-optimization case. In particular the function that determines whether or not a line is required seems likely to be subtle and error-prone.