Started as reply to:
http://forum.lazarus.freepascal.org/index.php/topic,23238.msg140277.html#msg1402772. One of the (almost) show stoppers for Lazarus in Mac Os is the terrible slowness of the Source Editor. At least in my dual core MacBook.
I thought that this would be fixed in RC2 but this behavior still exists.
Well I am not aware, that his was reported by anyone. So there is (was) no work/investigation into that.
And afaik, for many people this does no happen, for them it works fast.
Before going into details, there are 2 or 3 possibilities that come to mind first.
I assume a normal unit? few 100, maybe 3 or 4 thousand lines, of up to 1000 chars length.
Bigger should work too, I test with massive files sometimes, but lets start with that.
1)
(probably not) scrolling. This would be, if only scrolling was slow, but nothing else.
In old days (0.9.28 or 0.926 even), scrolling would mean to print all the chars in the new position, instead of moving the existing bitmap.
But then typing would be fast.
2)
font. Please try a different font or font size.
If your font is not strictly monospaced then the editor has to force it. This is more work. (though 40% cpu seems to high for this alone)Also on Mac,
(read notes at the end of post)
Some fonts use sub-pixels, which is not supported and leads to the same effect. For testing use a different font sizes.
Also ensure in the editor settings, page "editor/display", that the field "extra CHAR spacing" is set to 0. Any other value causes the same effect.
3)
too much repaint....
Can you disable the following 2 settings, and retry please. Page "editor/display":
- "Show overview Gutter"
- "Show Class/Proc Hint"
4)
Any other IDE operation.
Open a none-pascal/plain text file, and see if there is a difference.
Or put SynEdit (if you want with pas HL) on a Form, and run this (if you copy and paste text, then you need no file loading, no code of your own)
5)
How much is it affected by the size of the window? Is the dependency "linear" ?
e.g. editor shows only 2, 10, 20, 40 lines, (always the same length)
Does the cpu go like 2%, 10%, 20%, 40% ?
-----------------
About "2 font"
- Re-compile the IDE with SYNFONTDEBUG defined ( -dSYNFONTDEBUG ),
- Then start it from console, with a logfile:
In a shell:
/path/to/lazarus/lazarus.app/Contents/MacOS/lazarus --debug-log=/path/to/yourfiles/laz.log
Check for lines, like:
Final result for FONT Width=xxx Overhang=xxx eto=BOOL
If eto is FALSE, (for the font, that you use / see name) then all is good. If it is true, then the extra work happens.
About "3 too much repaint"
- Re-compile the IDE with SYNSCROLLDEBUG defined ( -dSYNSCROLLDEBUG ) Can be done together with the above)
- Then start it from console, with a logfile
Look for the lines that say
PAINT SynEdit123 0x200000 sfHasScrolled=BOOL rect=(10,5,200,100)
- If you edit a line, the high of the rect(last minus 2nd figure / 100-5 = 95) should be 1 or 2 lines only.
- Note you may get a 2nd paint of 40 to 60 pixel width all to the right rect=(500, Y, 550, Y2)
------
Additionally, to make sure nothing else of unexpected nature happen, you might want to compile with:
SynCheckPaintLock
AssertSynMemIndex
SynAssert
SynAssertFold
Those cause Exceptions, if things go wrong, so you will notice.
And add -Criot too