libgedit-gfls File Loading Overview

libgedit-gfls File Loading Overview

Previous implementation

With the previous implementation in gedit and libgedit-gtksourceview, loading big files was very slow. This was mainly because of many function calls to insert the content into the GtkTextBuffer in many small chunks. So that's something to avoid, ideally the whole content needs to be inserted at once into the GtkTextBuffer.

Loading and inserting the content in small chunks was done to avoid having two copies in memory at a time. This goal was not worthwhile, because once the text is in the GtkTextBuffer, it consumes much more memory than the corresponding file size, especially with syntax highlighting enabled.

There was a comment in the code with “welcome to a really big headache”. The code was messy and difficult to understand. With libgedit-gfls, things are hopefully better in that regard, by separating out many utilities.