Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 52952 - (PATCH)gnome-terminal poor text selection algorithm implementation leads to poor performance
Summary: (PATCH)gnome-terminal poor text selection algorithm implementation leads to p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 59768
  Show dependency tree
 
Reported: 2004-06-04 00:32 UTC by devsk
Modified: 2004-08-17 23:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Don't match patterns when not needed (gnome-terminal-2.6.1-dumbo.patch,2.04 KB, patch)
2004-06-04 00:35 UTC, devsk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2004-06-04 00:32:54 UTC
This patch was submitted to gnome-terminal folks sometime back and it hasn't made it into the main. Please include it in the next gnome-terminal ebuild. The bug is as follows: Code tries to match every text selection to a set of patterns. This matched pattern is not used if CTRL is not pressed. That means every click and drag of mouse leads to few regular expression searches for the text getting selected, although the selected text will never be used if CTRL is not pressed even if it matches one of those regular expressions, hence wasting CPU cycles for each click. This makes text selection consume lot of CPU and very slow. This patch moves the pattern matching inside of the check for CTRL mask so that we match only if CTRL is pressed, hence not hindering normal text selection.

This patch makes a LOT of difference to g-t's performance.

Reproducible: Always
Steps to Reproduce:
1.Open up a gnome-terminal
2.make the window large. 
3.open a document with large amount of text.
4. start randomly selecting and deselecting text
5. watch how cpu usage goes up and how slow the highlight appears on screen.

Actual Results:  
text selection slow

Expected Results:  
text selection shouldn't so slow.
Comment 1 devsk 2004-06-04 00:35:50 UTC
Created attachment 32625 [details, diff]
Don't match patterns when not needed
Comment 2 devsk 2004-06-04 00:37:07 UTC
this patch is against 2.6.1
Comment 3 devsk 2004-06-08 20:58:51 UTC
any news?
Comment 4 Alastair Tse (RETIRED) gentoo-dev 2004-06-09 06:20:31 UTC
i think this patch would be better attended to upstream with the gnome-terminal developers. have you sent this patch to them?
Comment 5 devsk 2004-06-09 08:16:35 UTC
yes...report number 122656

http://bugs.gnome.org/show_bug.cgi?id=122656

but it never made it.
Comment 6 devsk 2004-06-18 18:35:58 UTC
any news on this patch?
Comment 7 foser (RETIRED) gentoo-dev 2004-07-20 04:48:25 UTC
it looks good to me.. although i've never seen the described behaviour. I'm not sure what this has todo with CTRL, i guess thats keyboard behaviour i'm not familiar with. Can you give a specific scenario to reproduce this ?

Note that with this patch applied i did have a non-reproducable crash, it might be unrelated.
Comment 8 devsk 2004-07-20 09:05:06 UTC
OK, the problem is that when you move your mouse around in a g-t, internally it searches for patterns(currently only URL spec, skey) matching the strings under the mouse using regex library. Just have a huge(not nece'ly full screen) g-t window with lots of text in it and just moving your mouse inside it will raise your CPU usage. You can hold CTRL down and left click on a URL and it will open up a epiphany/galeon/mozilla window or CTRL-right click will popup a special URL menu. The code keeps matching the URL even when CTRL is not held. This patch makes sure that pattern match happens only when CTRL is pressed, because that's the only codepath using the matched string.

Selecting text will raise CPU usage more. Huge amounts of scrolling text will also produce the similar spike in CPU.
Comment 9 Mike Gardiner (RETIRED) gentoo-dev 2004-08-17 23:57:34 UTC
Added to gnome-terminal 2.6.1-r1.