[Lazarus] Compile time varies dependiong on usage, why?

Michael Van Canneyt michael at freepascal.org
Sun May 26 08:54:23 CEST 2019



On Sun, 26 May 2019, Bo Berglund via lazarus wrote:

> Lazarus 2.0.0 / FPC 3.0.4 (both 32 bit) on Windows 7-x64
>
> When I am working on my project and for example make a small change
> like moving a few controls on the form, then build the executable
> (Run/Compile) the time taken to complete varies a LOT as follows:
>
> 1) I have not done anything inside Lazarus for a number of hours, say
> overnight, but the IDE has been running all the time. Then after I
> move the controls it takes a rather long time to compile the exe file.
>
> 2) I am active in Lazarus for example some minutes after the situation
> above (move the controls a bit more), then the compile is a LOT faster
> and only takes a few seconds.
>
> What causes this behaviour? Is there some "user activity timeout"
> built into Lazarus that puts it into a sleep mode regarding compiles
> or what? The IDE itself works normally.
>
> Not a big issue but irritating nevertheless.

Just a guess:

The IDE invokes the compiler as a separate process, so as far as the IDE is
concerned, every compile is a 'fresh' compile.

So it looks like you're simply observing the  effects of the Windows filesystem
cache. If you compile regularly, the filesystem cache is filled with files
that the compiler needs and compiling goes fast. If you do nothing for a
long time the OS starts slowly putting other files in the cache, and when
you compile it must actually go and fetch the files from disk, which takes
more time.

Your write program will not notice such things, but it would notice such things
if it opened randomly a lot of files.

There may be other factors involved (maybe lazarus decides to recompile the
LCL or other packages, altough it would really surprise me to hear that) , 
but I think the above is the most likely.

Michael.


More information about the lazarus mailing list