[Lazarus] RE : Console App Development

Martin lazarus at mfriebe.de
Sat Aug 13 19:14:01 CEST 2011


On 13/08/2011 17:35, Graeme Geldenhuys wrote:
> On 13 August 2011 12:13, Martin wrote:
>> Lazarus defers the scan for highlight+folding (one and the same) as well as
>> finding the longest line (required for horiz scrollbar). Both of them are
>> done once lazarus is fully operational, within idle, or if the tab is
>> selected.
> Would multi-threading help here - instead of idle timer process (which
> probably limits all the work to a single processor? Especially on
> today's multi-core CPU's? eg: create a thread pool of say 4 or 8
> threads. Then hand each task required per tab (highlighting, folding,
> codetools processing etc) to a thread as they become available in the
> pool. Maximize the usage of available processors/cores, that is what
> they are there for.
>
> Just a thought.
I guess yes, though not urgent.
I guess the IDE will probably at some point start getting there, and the 
above task can be included.

The speed up at project loading would be minimal, probably only 
noticeable if you have several source-editors open (and therefore more 
than one file visible).
Yet it requires synchronisation. When a user switches tabs to an editor, 
that hasn't been processed, then this editor removes it's scanning from 
the idle handler, and finishes it from whatever point has been reached 
(sources can be partially scanned).

Well the start up speed could differ, as files could be opened and 
loaded in parallel.

currently, opens all files at startup
- creates a tab and an editor for it, and assigns the text to the lines
- codetool checks for resources, need to load a form?
- not sure if  codetool needs anything else.

When all files are open, one tab will be activated. The editor for this 
file will perform a highlight scan. Also calculate the longest line, for 
the horiz scrollbar.

After that the IDE is ready and work can start.
Other editors will then start scanning on-idle

So in startup, only one editor (per open source-edit window) will be 
activated, and perform the scanning. This would not benefit much from 
threading. The file loading from disk itself, might benefit.


>> tabs / MSEide does not use the widgetset, hence it doesn't need to allocate
>> handles for each tab (I guess)
> I'm not sure how MSEide handles or allocates tabs, but I do know (from
> speaking to Martin) that MSEide only has one editor component
> instance. As you swap tabs, the buffer content of the editor component
> changes to that file.
>
> I have no idea how Lazarus handles this. Would you mind explaining,
> I'm just curious.
There is one editor instantiated for each tab. This does of course 
create extra handles, but I do not think that you will save much memory 
if you have only one instance. All the data hold by the editor, would 
have to be stored somewhere and swapped in and out as sources where changed.

Sure SynEdits could be changed to share one handle, and reduce the 
amount of handles needed. But I am not sure that will save much(timing 
wise, maybe memory wise, if there is a bitmap allocated for the synedit.

IIRC the handle is only allocated, once the tab is first time switched too.

Currently unused tabs do allocate memory for the highlight scan results 
etc. As this is added on idle.
That could be changed to be scanned only, once you switch to the tab. It 
would lead to a tiny delay on first time switching to a tab (not 
noticeable for normal files, but files with 10k or 100k lines might be 
noticeable).
In that context, I would be more worried about battery usage on a 
laptop. (which suffers from the on-idle work).


>> actually look decent. And I don't even know if geany has something like
>> codetools...
> I hear a lot of talk about CodeTools. What exactly does it do? I'm
> just asking, because if it's about generating code etc, MSEide seems
> to be doing a great job too. Code-Completion, code templates, syntax
> highlighting, code navigation etc are all possible and working well in
> MSEide.
I am not the expert on codetools. And I do not know if it takes any of 
that time.

Apparently MSEide then must have it's own sort of codetools.

Codetools does the scanning of the source, to provide the navigation, 
completion, hints, integration of form resources....

>
> So I guess my question is, what does CodeTools do, and what does
> SynEdit (the editor component in Lararus) do?

The only knowledge about pascal, that synedit has, is the highlighting, 
and with this the code folding, and divider-draw lines. All other pascal 
related work is codetools.





More information about the Lazarus mailing list