[gtksourceview] bufferoutputstream: add profiling support for fallbacks



commit 589c6a0f9b9210e2f7c9f63c55fcb89fa26c6782
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 1 13:17:41 2022 -0700

    bufferoutputstream: add profiling support for fallbacks
    
    This helps decode some performance issues when looking at how fallback
    character insertion is being handled.

 gtksourceview/gtksourcebufferoutputstream.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index b3f8e1dd..9d33ffaa 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -29,6 +29,7 @@
 #include "gtksourcebuffer-private.h"
 #include "gtksourceencoding.h"
 #include "gtksourcefileloader.h"
+#include "gtksourcetrace.h"
 
 /* NOTE: never use async methods on this stream, the stream is just
  * a wrapper around GtkTextBuffer api so that we can use GIO Stream
@@ -575,6 +576,8 @@ insert_fallback (GtkSourceBufferOutputStream *stream,
                return;
        }
 
+       GTK_SOURCE_PROFILER_BEGIN_MARK
+
        /* If we are here it is because we are pointing to an invalid char so we
         * substitute it by an hex value.
         */
@@ -588,6 +591,8 @@ insert_fallback (GtkSourceBufferOutputStream *stream,
                                &stream->pos, (const gchar *)out, 3);
 
        ++stream->n_fallback_errors;
+
+       GTK_SOURCE_PROFILER_END_MARK ("BufferOutputStream", "insert_fallback");
 }
 
 static void
@@ -606,6 +611,8 @@ validate_and_insert (GtkSourceBufferOutputStream *stream,
                return;
        }
 
+       GTK_SOURCE_PROFILER_BEGIN_MARK
+
        text_buffer = GTK_TEXT_BUFFER (stream->source_buffer);
        iter = &stream->pos;
        len = count;
@@ -715,6 +722,8 @@ validate_and_insert (GtkSourceBufferOutputStream *stream,
        }
 
        g_free (free_text);
+
+       GTK_SOURCE_PROFILER_END_MARK ("BufferOutputStream", "validate_and_insert");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]