4 ms·
Formatting a file could be a single operation that creates a single array of lines. Normally the formatter is a separate program that actually gets the input as
by whazor 3y ago
Formatting a file could be a single operation that creates a single array of lines. Normally the formatter is a separate program that actually gets the input as string and returns a new string as output. So the extra concatenation and splitting would not cost much extra.
The formatting is often difficult enough that it will need a separate data structure anyways.