After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 700581 - Improve performances by removing some redundant UTF-8 checks
Improve performances by removing some redundant UTF-8 checks
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 637270
 
 
Reported: 2013-05-18 15:35 UTC by Sébastien Wilmet
Modified: 2014-08-15 03:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkTextView: remove some redundant UTF-8 checks (1.36 KB, patch)
2013-05-18 15:36 UTC, Sébastien Wilmet
none Details | Review
Test the performances of gtk_text_buffer_insert() (558 bytes, text/plain)
2013-05-18 17:10 UTC, Sébastien Wilmet
  Details

Description Sébastien Wilmet 2013-05-18 15:35:09 UTC
There are some redundant UTF-8 checks in GtkTextView, so it degrades performances.

Also, allowing invalid UTF-8 chars is a first step to fix bug #637270.
Comment 1 Sébastien Wilmet 2013-05-18 15:36:22 UTC
Created attachment 244624 [details] [review]
GtkTextView: remove some redundant UTF-8 checks

It improves the performances. The documentation says that the strings
must be in UTF-8 format, so normally the applications call
g_utf8_validate() before gtk_text_buffer_insert() or similar.
Comment 2 Sébastien Wilmet 2013-05-18 16:39:58 UTC
With the patch applied, all the g_utf8_validate() in gtktext*.c are gone.
Comment 3 Sébastien Wilmet 2013-05-18 17:10:04 UTC
Created attachment 244635 [details]
Test the performances of gtk_text_buffer_insert()

Here are the results with a 254 MB file:

With the UTF-8 checks in GtkTextView:
> Elapsed time: 7.28

Without:
> Elapsed time: 5.80

Unfortunately, when the file is opened with gedit, there is not a big difference with or without the patch. There are other things that take more time.
Comment 4 Timothy Arceri 2013-10-01 22:50:30 UTC
You might like to bump the gtk dev mailing list to ask for a review and see if the devs think this is a good idea or not.
Comment 5 Sébastien Wilmet 2013-10-02 19:05:21 UTC
Timothy, this bug will be fixed when the bug #637270 is fixed (there is a dependency between the two bugs).

Fixing this bug alone will not improve a lot the performances when opening a big file. The bottleneck in gedit is elsewhere.
Comment 6 Timothy Arceri 2013-10-03 22:56:37 UTC
Well then I dont see much point in keeping this bug open. Seeing as the performance gain is so small there is not much point removing these checks without doing the rest of what is required in the other bug which means there seems no need to track this part separately.

*** This bug has been marked as a duplicate of bug 637270 ***
Comment 7 Sébastien Wilmet 2013-10-04 12:21:16 UTC
Hrm, this bug is NOT a duplicate. The patch can be useful in the future.

If you want to triage bugs, this one is the wrong place.
Comment 8 Timothy Arceri 2013-10-04 13:02:32 UTC
I guess my point was the patch is so small it should probably just be part of a patch series for the other bug since its not much use on its own.
Comment 9 Matthias Clasen 2013-10-05 22:45:23 UTC
I don't think it is a good idea to take out utf8 validation before we are able to handle non-utf8 text.