Disable autosave on compilation lazarus / 9-Editor ---------------------------------------------------------------------- atasoft · 2011-06-16 07:31 I am new in Lazarus but I was working with Delphi for few years. I notice two things that I do not like in Lazarus (maybe I am doing something wrong): 1. I do not like when the Lazarus saves my project any time I compile it. I want to modify my code and save it after the compilation and when I am sure that it works. 2. The compilation time in Lazarus takes a lot of time if I compare it with the Delphi 6. I will appreciate any ideas that will help me to solve the above issues. Andreas ---------------------------------------------------------------------- Leledumbo · 2011-06-16 16:37 Currently, it's the behavior and can't be changed yet. You may ask a feature request through the bugtrackerRemember that Lazarus and Free Pascal has thicker abstraction layer (cross widgetset - cross OS - cross architecture) than Delphi (win32 - i386 only), so it's normal that more files would need to be loaded to memory. Anyway, it should be only for the first time compilation happens. Subsequent compilation should take much less time (1-2 seconds) ---------------------------------------------------------------------- Martin_fr · 2011-06-16 18:06 Quote from: atasoft on June 16, 2011, 09:31:27 am1. I do not like when the Lazarus saves my project any time I compile it. I want to modify my code and save it after the compilation and when I am sure that it works. As already answered, the saving can't be prevented (yet). In Delphi, the IDE and the compiler are very tightly coupled. Lazarus and FPC are two separate applications (even though if you install Lazarus you do not normally need to worry about this). So fpc, must get the files somehow. - For an completely unsaved project, Lazarus creates files in a temporary folder. - For an already saved project, Lazarus saves the files.   The idea of creating temp files here too, or using pipes have been discussed, and may one day be implemented. But it does not look as if it will be soon... Personally, when it comes to keep "working versons" of my code (which is actually for every project), I use revision control systems. It is easy to install your own local copy of SVN, GIT or CVS, ... (client and server). Once I made a change, and it works => I do a commit. Quote 2. The compilation time in Lazarus takes a lot of time if I compare it with the Delphi 6. Regarding the speed: If you only want to know, if your files do compile, but you do not actually need the exe; then you can use "quick compile" (from the "run" menu). It compiles, but does not link the files. (Linking takes a substantial amount of time) If you compile a test/debug exe, switch of smart linking. That may save a little time too. ---------------------------------------------------------------------- atasoft · 2011-06-18 16:42 Thanks for your immediate answer. The idea of using revision control system is good. I will try Tortoise SVN. I understood the difference between Delphi and Lazarus but the speed is really a problem. If I make a change in my code I want to run the application and check it and not only compile it. I made the following test on both Delphi 6 and Lazarus v0.9.30. I created a project with an empty form and I ran it. In Delphi was a matter of miliseconds but on Lazarus took 7 seconds. Each time I run it on Lazarus without any modification takes 7 seconds while on Delphi it runs almost immediately!!! My computer is a Dell Inspiron 6400 Notebook: intel core 2 cpu T7200 2GHz, 1GB of RAM, Windows XP SP3. You understand from the above that the Lazarus is more than 10 times slower and this affects productivity. ---------------------------------------------------------------------- Martin_fr · 2011-06-19 13:50 About the speed: Yes it is known that Lazarus is slower. One of the answers you will get very often: "it is the price for cross platform ...". In a way it is true, Lazarus is more modular (compiler and IDE are two separate applications. I know that does not help you, But there is no solution to it at current. Update to the information: The time you experience is not only the compilation time, it is also the time needed to launch the application. That is, the only debugger available at the moment is GDB, and to launch the app under GDB takes a (little) time too. You should notice in the message window, when it says "compilation finished" (or similar). For example on my PC ( 4 years old), Lazarus with lots of range check, and other tests (for developing, but all of them taking extra time): Compilation of a new, empty form 3 to 4 secs, launching the app another 3 to 4 sec. Total about 7. You can try to develop under Linux (in a Virtual Machine). The compiling and Linking is a bit faster there (As far as I know). If you just want to launch your app, and need no debugger, disable it in the environment/options. Or run the app from outside the IDE, after compiling. Of course, if there still are bugs, you do need the debugger... Anyway the way I solve the issue on bigger projects, is by using testcases. That way I do not need to compile the entire project. ---------------------------------------------------------------------- Leledumbo · 2011-06-19 16:42 QuoteEach time I run it on Lazarus without any modification takes 7 seconds while on Delphi it runs almost immediately!!!As Martin says, this is due to the debugger, not the compiler. You can try to prove by compiling from command line. QuoteYou can try to develop under Linux (in a Virtual Machine). The compiling and Linking is a bit faster there (As far as I know).Compilation: yes. Linking: no. On Linux FPC still depends on ld which is much slower than FPC's internal linker on Win32/64. ---------------------------------------------------------------------- atasoft · 2011-06-19 18:13 QuoteAnyway the way I solve the issue on bigger projects, is by using testcases. That way I do not need to compile the entire project.Martin_fr, what do you mean by "testcases"? How do they help not to compile the entire project? ---------------------------------------------------------------------- Martin_fr · 2011-06-19 19:55 unit test cases. There is an entry in "file" / "new" It does require you to abstract the logic and display of you app. (Because the Display part is far harder to test) Let's say, I need to store data in memory, and implement a Tree. Then the TestCase only uses that one unit (or related units). The testcase just fills the Tree with dummy data, and test it => so when I build the final app, I am far less likely to experience problems. Of course some full-app testing remains in the end. If you use databases, then it depends on how you have implemented this. If all DB access is put into it's own unit(s), then you can test it. If you drop a TDBGrid on the form, that will be much harder. Because now the database and the form a connected. So now your test must at least compile that one form. A better way, might be to have it in a TFrame. Then in your test you create a form, using only that frame, and you trigger the events you whish to test. For example you can send keystrokes (there is unit to emulate this afaik) On the other hand, TDBGrid itself is not your code. And if you events do not access the TDBGrid, then the event-code, can be written entirely stand-alone. E.g if you want to check if a user-entered string does follow a certain format (looks like a date). You can write that as a stand alone function. Form1.OnDBGrid1CellChanged, just calls the function. As an example, I started this for SynEdit (the test is included in Lazarus). It does not (yet) test the entire SynEdit (by far not). But, if I made changes to SynEdit, instead of rebuilding the IDE, and test SynEdit as part of the IDE; instead of that, I would just rebuild the SynEdit package, and start the testcase. Structuring your code in a way that testcases can be written more easily and more efficient, is a matter of experience. There still will be a need to test the final app, but by that time a lot of issues are already fixed. ---------------------------------------------------------------------- atasoft · 2011-06-21 19:07 It seems interesting. I will try it. Thank you.