Recent

Author Topic: Compiling/linking speed still not on par with Delphi  (Read 12398 times)

tk

  • Sr. Member
  • ****
  • Posts: 368
Compiling/linking speed still not on par with Delphi
« on: March 04, 2015, 09:11:37 am »
Found this thread:
http://forum.lazarus.freepascal.org/index.php/topic,958.0.html

Is there any development progress in this regard?
At least on Win?
Is the only reason that prevents us to switch to Lazarus entirely...



Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: Compiling/linking speed still not on par with Delphi
« Reply #1 on: March 04, 2015, 11:11:06 am »
I could not follow your link. However this link suggests that  later versions of Delphi are similar to Lasarus http://forum.lazarus.freepascal.org/index.php/topic,20397.msg117666.html?PHPSESSID=720c0e988e3a8f488d0aaf467523aa09#msg117666

I suggest that if you have plenty of RAM, you search the forum. One post by CaptBill suggests 11 seconds for a complete IDE rebuild using IMDisk on Windows. A further web search will show how to set up ramdisk use in Linux.

Bram71

  • New Member
  • *
  • Posts: 26
Re: Compiling/linking speed still not on par with Delphi
« Reply #2 on: March 04, 2015, 11:43:01 am »
I'm on linux and use a tmpfs (ramdrive on win) folder to store all unit output files e.d. (-FU option in project).

Put the line below in /etc/fstab and use /tmp as this folder.

tmpfs   /var/tmp   tmpfs   defaults,noatime,mode=1777   0   0

After that issue a mount -a and your good to go...

v.denis

  • Guest
Re: Compiling/linking speed still not on par with Delphi
« Reply #3 on: March 04, 2015, 01:37:10 pm »
Quote
Compiling/linking speed still not on par with Delphi

I can just share my observations.

As I know FPC already able to create PE/COFF images.

Delphi linking is fast because it just glue all DCUs into final executable.
It uses buffered stream to write so no big disk overhead.

If you link with run-time packages, it's even faster.

I don't know how it's done in FPC (i.e. maybe there are LTOs - Link Time Optimizations, which take time).
Maybe some FPC member has some benchmarks.

One more thing making run slower (time from pressing F9 to app launch):
When building done, debugger started. GDB for some reason start slowly. I don't know why, but I guess it parses debug info.
« Last Edit: March 04, 2015, 01:39:58 pm by v.denis »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10542
  • Debugger - SynEdit - and more
    • wiki
Re: Compiling/linking speed still not on par with Delphi
« Reply #4 on: March 04, 2015, 01:54:03 pm »
One more thing making run slower (time from pressing F9 to app launch):
When building done, debugger started. GDB for some reason start slowly. I don't know why, but I guess it parses debug info.

GDB launch time is indeed noticeable.  It has many reasons.
Not sure if gdb is slower than Delphi scanning the debug info. But on Windows the most stable is gdb 7.2 (though idf you have win 7 and up, you may need 7.7.1 / avail on our sourceforge site). Newer gdb versions are a few percent faster at startup, dbut they introduce many other issues. So I do not recommend them.

GDB may be a fraction faster if you set  "DisableLoadSymbolsForLibraries" to "True"
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#internal-error:_clear_dangling_display_expressions

Another speed issue with using gdb is that the IDE needs to communicate with gdb sending and receiving commands/responses via stdin/stdout of gdb. That is not very fast either.


In Lazarus 1.4 you can install fpdebug (beta) and that will be a bit faster.

---
Still if your app is so big that it takes really long to compile, I recommend not to compile it all the time. Develop your code using a testcase, keep that small, and it will build and run in no time at all.
Not only is it faster, it is also easier to get the code stable, and working.

v.denis

  • Guest
Re: Compiling/linking speed still not on par with Delphi
« Reply #5 on: March 04, 2015, 02:00:34 pm »
Quote
In Lazarus 1.4 you can install fpdebug (beta) and that will be a bit faster.
I'd say it is much faster start time. I really appreciate yours and Joost's work on it.

I think Delphi symbol loading is not very noticeable, because it caches unit information. I'm not very sure here. Though it costs RAM. Delphi can run out of memory on really big projects.
« Last Edit: March 04, 2015, 02:20:27 pm by v.denis »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Compiling/linking speed still not on par with Delphi
« Reply #6 on: March 04, 2015, 02:34:12 pm »
Is the only reason that prevents us to switch to Lazarus entirely...

How long does it take for your project then? For me it is hard to believe that compiling + linking time with FPC on modern machines could be a problem. We are talking about tens of seconds maybe. The big Lazarus project itself takes over 2 minutes to build clean, but a clean build is rarely needed. Normal builds are ~10 - 20 sec.

At least I use most time scratching my head and thinking how to implement something. The compilation time is irrelavant.
Things were different at 1990's. Then both computers and C-compilers were slow. You could start compiling a big C-project, go for luch, come back and the compilation still went on ...
Yes, TP and Delphi shined already then. Then it made a big difference but not any more really.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Scoops

  • Full Member
  • ***
  • Posts: 103
Re: Compiling/linking speed still not on par with Delphi
« Reply #7 on: March 04, 2015, 05:34:56 pm »
Hi All,

Personally I have never even posed the question about Delphi/Lazarus compile times,
I started off with Borland C++ and just a little change to get everything spot on would
take ages, Delphi 7 is super fast but its old, so even if Lazarus/FPC takes a little longer
its because its continually being updated to support UTF-8 etc etc etc.  And who wants to
buy a New Delphi XXXX which costs a fortune ... Stick with the Community and support Lazarus.


Leledumbo

  • Hero Member
  • *****
  • Posts: 8774
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Compiling/linking speed still not on par with Delphi
« Reply #8 on: March 04, 2015, 05:48:51 pm »
Is the only reason that prevents us to switch to Lazarus entirely...
This is the first time I see a person refusing his applications to go cross platform and cross widgetset just because of a few seconds (and it's only for the first compilation, further compilations should only take a blink of an eye) of compile time. Even for runtime it's still questionable unless the code runs for weeks or months.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10542
  • Debugger - SynEdit - and more
    • wiki
Re: Compiling/linking speed still not on par with Delphi
« Reply #9 on: March 04, 2015, 06:49:24 pm »
Found this thread:
http://forum.lazarus.freepascal.org/index.php/topic,958.0.html

Is there any development progress in this regard?
At least on Win?
Is the only reason that prevents us to switch to Lazarus entirely...

1) there is some development yes. If you use many packages and all of them need to be compiled, then Lazarus now uses threads and that speeds up the process. Only works for packages though.

2) Rather than (or in addition to) linking to another thread, tell us what you experience.
How many units of which size has your project?
How long does it actually take?
Is the slow part for you the linking too?

Also how much (free) memory do you have? Linking needs serious memory, or it will indeed get very very very slow.




tk

  • Sr. Member
  • ****
  • Posts: 368
Re: Compiling/linking speed still not on par with Delphi
« Reply #10 on: March 08, 2015, 07:08:36 pm »
This is the first time I see a person refusing his applications to go cross platform and cross widgetset just because of a few seconds

Well:
1. we're not refusing to do so, because we HAVE TO support Linux, so yes we compile BOTH in Delphi AND Lazarus now.
2. I personally am using Ctrl+F9 almost every minute when developing/syntax checking and F9 very often to launch and test and yes, Delphi is much faster than Lazarus now. The few seconds each time matter a lot here. And yes we compile rarely the whole project group.

I just asked about the development status of this feature. If you don't understand my questions then, please, don't answer next time.

In case there was some speed up in future it would be great.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10542
  • Debugger - SynEdit - and more
    • wiki
Re: Compiling/linking speed still not on par with Delphi
« Reply #11 on: March 08, 2015, 07:32:54 pm »
2. I personally am using Ctrl+F9 almost every minute when developing/syntax checking and F9 very often to launch and test and yes, Delphi is much faster than Lazarus now. The few seconds each time matter a lot here. And yes we compile rarely the whole project group.

I just asked about the development status of this feature. If you don't understand my questions then, please, don't answer next time.

In case there was some speed up in future it would be great.

As for "Syntax check:

Afaik ctrl-F9 defaults to compile. That includes linking.
There is an entry "Quick compile", which afaik skips linking. So it is faster, still checks the syntax.

== EDIT== Maybe in future a way can be added to just compile the unit you worked on. It wont tell if dependent units still compile, but be quick for syntax errors in that one unit.

It may still be slower than Delphi. For fpc all needs to be saved to disk, and then compiled. That includes loading ppu of other packages. I read some where that Delphi does some of that in memory.

Maybe you can tune your OS to cache them in memory, or you mount a ramdisk, and copy them (the ppu of the rtl and base packages) there.


As for actual running. FPDebugger is probably faster. But has less features yet.

« Last Edit: March 08, 2015, 07:37:01 pm by Martin_fr »

 

TinyPortal © 2005-2018