I cannot reproduce the extreme slowness anymore, no matter what I do. What I have now is only generally relatively high CPU usage compared to Qt and some stuttering when scrolling, but the extreme lag and sluggishness when simply typing text is gone. I don't know what caused it and I don't know what made it go away (I did *not* restart X, it just went away from one moment to the other (and no there were no other processes running also)).
2012/3/25 Martin :
please attach your editor options
see attachment
Define SYNFONTDEBUG and watch the log when the IDE starts
?TheFontStock.CalcFontAdvance: ........ eto=True
No messages with "eto" at all.
If true, your font is problematic. Try an other one
(Also happens, if your system can have font sizes of half-pixel. That may be
the case with newer gtk. In that case: change the size.)
Envy Code R, size 10. This is the font size this font was optimized for, most other sizes would look ugly anyways, (at least the smaller ones). Changing the font and also the antialiasing settings was the first thing I tried when the problem appeared but it did not make any difference at all.
Show quoted text 12 lines
So time to go for the defines I originally mentioned:
? ?SynCaretDebug ? SYNSCROLLDEBUG ? VerboseSynEditInvalidate
SynCheckPaintLock
Watch for paint. It gives the rectangle that is painted.
it always paints full width. So left/right will be a big diff.
But it should only point 1 or 2 lines ( a line has between 10 and 20 pixel,
depend on font). Watch Top Bottom
There may be a 2nd paint with left/richt all to the right (10 pixel on the
right: that is the overview gutter. Its an embedded panel, so it does not
interfere with the rest of paint)
The following is when I grep for PAINT and press a key three times. There will only be one paint per key press which seems ok to me (actually there are a few more paints every now and then when the cursor blinks but also only one for cursor on and one for cursor off)
PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=0,t=374,r=689,b=408 PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=0,t=374,r=689,b=408 PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=0,t=374,r=689,b=408
and here is some more output unfiltered for one keypress, surounded by a bit of focus change and cursor blinking:
SynEditCaret CreateCaret for HandleOwner=SynEdit1:TIDESynEditor DebugShowCount=0 Width=2 pref-width=2 Height=15 FCurrentCreated=False FCurrentVisible=False
SynEditCaret SetPos for HandleOwner=SynEdit1:TIDESynEditor x=119 y=375 SynEditCaret ShowCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=0 SynEditCaret DestroyCaret for HandleOwner=SynEdit1:TIDESynEditor DebugShowCount=1
SynEditCaret CreateCaret for HandleOwner=SynEdit1:TIDESynEditor DebugShowCount=1 Width=2 pref-width=2 Height=15 FCurrentCreated=False FCurrentVisible=False
SynEditCaret SetPos for HandleOwner=SynEdit1:TIDESynEditor x=119 y=375 SynEditCaret ShowCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=0 PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=119,t=374,r=121,b=389 SynEditCaret HideCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=1 SynEditCaret ShowCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=0 TCustomSynEdit.InvalidateTextLines SynEdit1:TIDESynEditor FirstLine=27 LastLine=28
TCustomSynEdit.InvalidateTextLines TLazSynTextArea FirstLine=26 LastLine=27 rect=l=55,t=374,r=676,b=408
TCustomSynEdit.InvalidateTextLines TLazSynTextArea FirstLine=26 LastLine=27 rect=l=55,t=0,r=676,b=0
TCustomSynEdit.InvalidateTextLines SynEdit1:TIDESynEditor TCustomSynEdit.InvalidateGutterLines SynEdit1:TIDESynEditor FirstLine=27 LastLine=28
TCustomSynEdit.InvalidateGutterLines TLazSynGutterArea FirstLine=26 LastLine=27 rect=l=0,t=374,r=55,b=408
TCustomSynEdit.InvalidateGutterLines TLazSynGutterArea FirstLine=26 LastLine=27 rect=l=676,t=374,r=689,b=408
TCustomSynEdit.InvalidateGutterLines TSourceLazSynSurfaceGutter FirstLine=26 LastLine=27 rect=l=0,t=0,r=55,b=0
TCustomSynEdit.InvalidateGutterLines TSourceLazSynSurfaceGutter FirstLine=26 LastLine=27 rect=l=676,t=0,r=689,b=0
TCustomSynEdit.InvalidateGutterLines SynEdit1:TIDESynEditor SynEditCaret SetPos for HandleOwner=SynEdit1:TIDESynEditor x=126 y=375 PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=0,t=374,r=689,b=408 SynEditCaret HideCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=1 SynEditCaret ShowCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=0 SynEditCaret HideCaret for HandleOwner=SynEdit1:TIDESynEditor FDebugShowCount=1 SynEditCaret DestroyCaret for HandleOwner=SynEdit1:TIDESynEditor DebugShowCount=0
PAINT SynEdit1:TIDESynEditor sfHasScrolled=False rect=l=126,t=374,r=128,b=389
For all else:
run in valgrind. and see where the CPU goes
Maybe a sampling profiler like oprofile would be a better idea because most of the CPU actually goes to the X server process and also valgrind is painfully slow, next to unusable on my old hardware, I suspect I would have to wait an hour until I see the first IDE window appearing.
I suspect a GTK and/or xorg bug or flaw. There will be a new Ubuntu version in April, maybe the entire problem will go away, the 11.10 I am currently using is not known for great freedom from defects anyways.
Should the effect ever re-appear I will try to profile it and make more logs with the above defines, meanwhile I thank you for your assistance, since I am now more and more suspecting a bug in GTK itself I don't want to waste too much of your time.
Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: editoroptions.xml
Type: text/xml
Size: 3468 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120331/91868928/attachment.xml>