response to typing is very slow with code highlight with some files

Bug #818642 reported by Teo
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
gedit
New
Undecided
Unassigned
gedit (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

When editing files with code highlight mode set to "php" (maybe the same happens with other modes too), gedit sometimes is ridiculously slow to respond to typing. That is, when you type, the text you type appears with a very noticeably (and annoying) delay.

This seems to happen with some particular files more than others, so I attach one particular file with which I experience the issue. I guess the issue is triggered by some syntax pattern. I have some much bigger files that don't cause any trouble when editing them, so it is not just a matter of file size.

It is reasonable to expect that code highlighting increases cpu consumption, but definitely not that much.
I've used a few other editors with code highlight and NEVER seen one become so slow even with files a lot bigger than this

And even if computing the highlight had a critical cost, then more priority should be given to typing response than to computing the highlights, e.g. by only recomputing highlighting when the keyboard is idle for a given fraction of a second or (if this doesn't happen) every n-th character and not for every single character, etc

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: gedit 2.30.3-1ubuntu1
ProcVersionSignature: Ubuntu 2.6.35-30.54-generic 2.6.35.13
Uname: Linux 2.6.35-30-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Sat Jul 30 22:35:40 2011
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: gedit

Revision history for this message
Teo (teo1978) wrote :
Revision history for this message
Teo (teo1978) wrote :
Revision history for this message
Philip Langer (philchip) wrote :

I'm experiencing the same with LaTeX files having long lines!

If I change the highlighting, for instance, to .ini or a lot of other languages, the long delays go away when inserting text at the beginning of the line.

I created an example for testing (cf. attachment). Try to insert some characters at the beginning of the line.

Thanks a lot in advance!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gedit (Ubuntu):
status: New → Confirmed
Changed in gedit (Ubuntu):
importance: Undecided → Low
Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :

Same issue for me. Gedit is randomly a lot unresponsive to the keyboard while typing. This never occurs right after Gedit is opened, I have to typed at least bit before it happens.

Occurs on Ubuntu Precise (12.04) while editing Ada source files (small files). Was not so much slow on Ubuntu Maverick.

Tried Medit, which does not suffer from the same issue -but which suffers from others issues), so don't believe it is due to the syntax highlighting, as as‑far as I know, Gedit and Medit use the same framework for syntax highlighting. Or else, if it's really due to syntax highlighting as some one above suggested, may be regex based syntax highlighting is not a good idea.

Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :

I tried to disable syntax highlighting multiple times (selecting raw‑text in the colouring mode menu), and this changed nothing. I suspect this may be due to the undo‑stack, but can't find any configuration to reduce its size (or even disable undo) for comparison, which would be required to know if that is really this. The hypothesis of the undo‑stack would explain why it happens after a more or less short time of editing, and not immediately after a file is opened in Gedit.

Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :

I finally could reduce the undo stack size from the DConf editor, but this changed nothing. That's not the keyboard, as everything is fine from Nano. The workaround I'm using, is to use Komodo.

So far: it's not due to the undo stack, nor to syntax colouring, nor to line length, nor to file size, although any of these may have an effect, the behaviour occurs also without any of these.

Revision history for this message
EsAmo (esamokoram) wrote :

Tango editor: typing delay ~ 1.5 seconds.

Clasic editor: typing delay ~ 0.5 seconds.

Time differs depending on what is shown on the screen (because the text is colored only partially).

Proc 2x 1.7 Ghz, 500 lines file.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.