GNOME Bugzilla – Bug 320360
speed up iter_forward_to_end
Last modified: 2005-11-02 05:18:46 UTC
gtk_text_iter_forward_to_end shows up in some profiles, for instance in gedit's replace all. here is a (somewhat pathological) bench that moves an iter to end in a loop.
Created attachment 54165 [details] bench.c bench
Created attachment 54166 [details] sysprof profile screenie clearly shows the two offenders
Created attachment 54167 [details] [review] first simple patch This patch was simple enough and didn't require to dig into the TextView internals. Despite its simplicity and the fact that it's a code cleanup, it brings down gtk_text_iter_backward_char to 22%
Created attachment 54182 [details] [review] patch Also the other offender can be given the same treatment: this reduce the test case (run with a 5000000 loop, by mistake I attached a version where I reduced the loop lenght) from ~67 seconds to ~40 seconds (measured with /usr/bin/time)
2005-11-02 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets): * gtk/gtktextiter.c (gtk_text_iter_backward_chars): Replace manual offset calculations by g_utf8_offset_to_pointer(). (#320360, Paolo Borelli)