Skip to content

Backport performance improvements for pathologica data (binary) insertion into buffer

This is a backport of a small performance improvement when we're hitting the fallback case of not being able to insert a character due to invalid UTF-8.

Instead of inserting one at a time (and all the GtkTextBtree/g_signal_emit overhead that comes with it) this tries to peek ahead and insert them as a larger batch. Additionally, to avoid GTK from hitting the "super long lines" performance issue, it tries to due the simplest/dumbest thing I could think of and just insert a newline after 80 characters.

Combined, I can actually open binary files (even though they're still rather useless) at least it allows users to close a tab/window/etc.

test-widget in both master/gtksourceview-4-8 don't yet handle this correctly, i still need to find time to update those to avoid the common issues I still see in doing the performance work, mainly:

  • dont update positions while loading
  • dont allow cursor focus while loading (or you'll get a11y updates for every insert sent over dbus to the compositor)

Merge request reports