Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-05

Compile time varies dependiong on usage, why?

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

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.

At first I thought that it was caused by my hard drive going to sleep, but I have an application that writes a file on the disk drive every 10 seconds to keep it from sleeping (Windows 7 otherwise stops it from running) and this is displaying the write time. So I checked it before testing today. No problems there, the drive write time is displayed as 0 ms in that app....

Bo Berglund Developer in Sweden

Reply by email

Mattias Gaertner
to Bo Berglund
Show quoted text 15 lines
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?

Probably your OS file cache.
For example antivirus and Windows update scans.
Or you used some other programs.

[...]

Mattias

Reply by email

Michael Van Canneyt
to Bo Berglund: Lazarus 2.0.0 / FPC 3.0.4 (both 32 bit) on Windows 7-x64 When I am working on my project…
Bo Berglund wrote 19 lines
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.

Reply by email

Luca Olivetti
to Michael Van Canneyt

El 26/5/19 a les 8:54, Michael Van Canneyt via lazarus ha escrit:

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.

Unrelated, but it does that quite a lot here: In "Addition and overrides" I added the build mode in the output directory. That shouldn't be a problem, but I have some projects with "default" and some other with "Default" (the default, no pun intended, changed for new projects some time ago) and that triggers a recompile (even under windows). There are other cases when I see the lcl and other packages recompiled when they shouldn't, but I didn't pinpoint the cause (it doesn't worry me that much).

Bye

Luca

Reply by email

Mattias Gaertner
to Luca Olivetti
[...]There are other cases when I see the lcl and other packages recompiled when they shouldn't, but I didn't pinpoint the cause (it doesn't worry me that much).

You can see the reason for recompile in the pop menu of the message "About ..."

Mattias

Reply by email

Bo Berglund
to Michael Van Canneyt: Just a guess: The IDE invokes the compiler as a separate process, so as far as the IDE is…
Michael Van Canneyt wrote 6 lines
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.

Seems like this is the likely cause...

My project is a video player tool and I use it at times to go over a number of video files (large files) then I go back to Lazarus and change things to improve the tool, compile and then I try my new additions/changes for a while (not via Lazarus debug even though the Lazarus IDE remains running).

So if the cache concerns the files I work on then most likely the videos will replace the other files in the OS cache...

Note to clarify:
I have two disks on my system, one a 512 GB SSD system disk (houses Windows C:) and one a 2TB SATA mechanical drive (D:) housing all of my work files.
I install programs (like Lazarus) on C: but try to keep all work files on the D: drive.
Obviously the C: drive access is MUCH faster since it is an SSD, so program loads etc should be very quick.

Bo Berglund Developer in Sweden

Reply by email