nagyistoce / qdevelop

Automatically exported from code.google.com/p/qdevelop
GNU General Public License v2.0
0 stars 0 forks source link

Optimisation required: Moving Cursor use 100% CPU #199

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Moving the cursor in the code editor with left/right/up/down arrow uses
100% of my CPU.

Original issue reported on code.google.com by fbol...@gmail.com on 1 Dec 2007 at 5:15

GoogleCodeExporter commented 9 years ago
I forgot to mention I tested it against revision 275. The 100% CPU on Cursor 
move
still persist.

Original comment by fbol...@gmail.com on 3 Dec 2007 at 3:55

GoogleCodeExporter commented 9 years ago
Can you share more information about your system? HW/SW?

Original comment by diegoi...@gmail.com on 5 Dec 2007 at 10:09

GoogleCodeExporter commented 9 years ago
With pleasure!

HW: Sony Vaio PCG K33Q (CPU Intel P4 3.0Ghz, 512 MB RAM)
SW: Ubuntu 7.04 (Gusty Gibbon) with Qt 4.3.2

I'm thinking the 100% CPU behavior might be related a costly function being 
executed
on every Keyboard Events instead of simply restarting a timer.

Original comment by fbol...@gmail.com on 6 Dec 2007 at 12:30

GoogleCodeExporter commented 9 years ago
Can you still reproduce this problem with latest svn code?

Original comment by Lord.Div...@gmail.com on 30 Jan 2009 at 9:12

GoogleCodeExporter commented 9 years ago
I just built latest from svn (revision 368) and moving the cursors still uses a
significant amount of CPU time. No longer 100%, since I got a faster machine, 
but
more than it should.

Compared to other text editors with syntax highlighting, such as GEdit, it does 
not
perform well.

Original comment by fbol...@gmail.com on 31 Jan 2009 at 2:39

GoogleCodeExporter commented 9 years ago
Maybe you should change this issue's type to "Enhancement" instead of "Defect".

Original comment by fbol...@gmail.com on 31 Jan 2009 at 2:40

GoogleCodeExporter commented 9 years ago
Well I can confirm that scrolling editor window is really processor-consuming. 
But
does it hurt? I'm asking because I haven't noticed this thing before your 
report,
although my notebook isn't very powerful.
You see it may be Qt's issue not our. GEdit uses Gtk+ which is somewhat faster.
Anyway we need a research, may be it's worth profiling QDevelop...

Original comment by Lord.Div...@gmail.com on 31 Jan 2009 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by Lord.Div...@gmail.com on 31 Jan 2009 at 3:01

GoogleCodeExporter commented 9 years ago
No need to profile, just have a look at textEdit.cpp line 1115

void TextEdit::keyPressEvent ( QKeyEvent * event )
{
...
}

I'm assuming this handler is called every time a key is pressed. It contains a 
lot of
"if" and "else if" that could be replaced by a clever "switch case" by 
event->key()
to improve performance.

Original comment by fbol...@gmail.com on 31 Jan 2009 at 5:27

GoogleCodeExporter commented 9 years ago
Actually, I'll give it a shot and see if I can improve it. Expect a patch today.

Original comment by fbol...@gmail.com on 31 Jan 2009 at 5:30

GoogleCodeExporter commented 9 years ago
I was wrong. I changed the "if" and "else if" for switch case (patch included) 
but it
did not make any difference on CPU usage.

However, I found out that scrolling up and down with the mouse also uses a lot 
of CPU
time. Finally it might have something to do with the drawing routines. I guess
profiling might help after all.

Original comment by fbol...@gmail.com on 31 Jan 2009 at 6:54

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Lord.Div...@gmail.com on 14 Feb 2009 at 7:32

GoogleCodeExporter commented 9 years ago
Hi all, this issue also reproduce on svn-453 release (my hw is Asus EeePC 
1000HA). I try to use 
QTcreator - it work quickly on editing but does not have a lot of useful 
functions. Also, time-to-time I 
observer process 'cc1plus' during typing text and it use a lot of cpu.

Original comment by adrozd...@gmail.com on 9 Apr 2009 at 1:22

GoogleCodeExporter commented 9 years ago
Do you use Qt 4.5? You know Qt 4.5 itself is rather buggy especially concerning
performance. I wouldn't recommend using Qt 4.5 yet.
Anyway we're working on performance of QDevelop.

Original comment by Lord.Div...@gmail.com on 9 Apr 2009 at 6:23

GoogleCodeExporter commented 9 years ago
My distrib is ArchLinux, qt 4.5 currently is system wide version of qt. Why 
process 'cc1plus' is start 
during typing?

And, what do you think about qscintilla editor-component? or you don't want 
extra dependency?

Original comment by adrozd...@gmail.com on 15 Apr 2009 at 1:32

GoogleCodeExporter commented 9 years ago
We'll consider this idea.

Original comment by Lord.Div...@gmail.com on 15 Apr 2009 at 10:33