Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Pages: [1] 2 3

Author Topic: Compile speed and binary size on AmigaOS 3  (Read 545 times)

0 Members and 1 Guest are viewing this topic.

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Compile speed and binary size on AmigaOS 3
« on: August 01, 2017, 08:58:48 PM »

Hi.

I'm measuring ~42 secs to compile HelloWorld.pas into an executable on an 68060@50MHz.
The resulting executable is 260kB.

Any way to optimize this?


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #1 on: August 02, 2017, 05:42:23 PM »

Yes, use the latest FPC nightly

http://build.alb42.de/fpcreleases/fpc-release.m68k-amiga.lha

it uses vasm and vlink which makes it much faster, and it has sections support, which makes the executables much smaller

The blog post about:
https://blog.alb42.de/2017/01/07/small-is-beautiful/
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #2 on: August 02, 2017, 07:44:16 PM »

Thanks.

I've tried the nightly.
The build phase takes a lot longer. I've measured ~100 seconds (> 2x) for the HelloWorld.
It seems to be stuck at 'linking...' forever.

The executable is a lot smaller, ~26kB (~10x).

During development I could live with larger binaries but build times should be faster. Is there a 'optimize' flag enabled by default?
Or can this be tweaked?


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #3 on: August 02, 2017, 08:10:01 PM »

 :o thats odd

I just downloaded this version and tried it:

Code: [Select]
5.Work:Sources> fpc hello.pas
Free Pascal Compiler version 3.1.1 [2017/08/02] for m68k
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Commodore Amiga
Compiling hello.pas
Assembling hello
Linking hello
5 lines compiled, 30.6 sec

And thats on a 68030/50 (my Blizzard 1260 is broken so I can't try currently). I remember on my 1260 it was around 10s. The main problem is usually not the calculation but the HD speed with 68060, because it have to load many files.
I hope you do not try anything strange, like compiling on a network device or so (or installed the units to a network device).

but to answer your question, yes the optimization is on by default -O2 but if it get stuck at Linking thats not the problem, at this moment only the Linker (vlink, from the vbcc package) is working, so not FreePascal at this point.
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #4 on: August 02, 2017, 08:27:54 PM »

No, I'm not using a network drive.

Unfortunately the internal IDE drive on the A4k is dead slow. Only ~1,7MB/s. Pretty much the same as on the A1200, so that makes we wonder why it's so fast on your A1200.
It's really that the majority of time is at the linking state and there is no HDD activity, only CPU. That takes up at least 55s of the ~78s.
How can I change the optimization flag on the fpc command?
Does the optimization also takes place at linking?


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #5 on: August 02, 2017, 08:37:52 PM »

hmm 1.7 is not bad, my 68030/50 is something like 1.3 MB/s  :P so thats not the reason

an other idea
could you check if you have an other vlink (most likely older) somewhere?

which vlink

should be the one in pp:bin/m68k-amiga/vlink
or

vlink -v

should be 0.15d, build date: Jan 10. 2017, 22:17:53

and also a an other vasm68k_std
?
which vasm68k_std

you can turn off the optimization with fpc -O- hello.pas but it does not influence the linking part
« Last Edit: August 02, 2017, 08:39:48 PM by ALB42 »
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #6 on: August 02, 2017, 08:39:54 PM »

How can I change the optimization flag on the fpc command?

I'll answer that myself. It's "-O1".
But it doesn't make a difference.
If there is a lot of RAM activity it could be that. I'm using the BigRam which is 1/3 slower than the standard FastRAM on the A4k.
But it shouldn't have that large impact.


Manfred
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #7 on: August 02, 2017, 08:44:34 PM »

The which command on both vlink and vasmm68k_std comes back with the ones on the FreePascal installation.
I have vbcc installed which comes with vlink, but it's a) also the latest version and b) should be later in PATH.


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #8 on: August 02, 2017, 09:00:58 PM »

I installed the latest vbcc just now, even copied the newer vlink 0.16 from there to the fpc folder, still around 30 s hmm strange

it needs about 10 MB Ram as it seems. but 1/3 slower should not make big difference, btw how much memory you have?
« Last Edit: August 02, 2017, 09:05:08 PM by ALB42 »
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #9 on: August 02, 2017, 09:09:57 PM »

I installed the latest vbcc just now, even copied the newer vlink 0.16 from there to the fpc folder, still around 30 s hmm strange

it needs about 10 MB Ram as it seems. but 1/3 slower should not make big difference, btw how much memory you have?
I'm having 16MB (stock A4k)+256MB (BigRam).

Maybe SnoopDos reveils something as to why the linker takes that long.


Manfred
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #10 on: August 02, 2017, 09:16:22 PM »

I installed the latest vbcc just now, even copied the newer vlink 0.16 from there to the fpc folder, still around 30 s hmm strange

it needs about 10 MB Ram as it seems. but 1/3 slower should not make big difference, btw how much memory you have?
I'm having 16MB (stock A4k)+256MB (BigRam).

Maybe SnoopDos reveils something as to why the linker takes that long.


SnoopDos didn't reveil a whole lot.
Only that vlink seems to spends a lot of time doing something after reading rtl/system.o.
That takes 50-60 seconds.
Right after that vlink is finished.


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #11 on: August 02, 2017, 09:33:20 PM »

I have to admit, I'm out of ideas, I point ChainQ to the thread, maybe he as ideas about it.
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #12 on: August 02, 2017, 09:58:02 PM »

Yeps, thanks.

Would be great if the build time could be reduced. After all my config is not that slow.
I will try this also on a Vampire setup to see how it goes there, and on my A1200 030.


Manfred
Logged

Chain-Q

  • Newbie
  • *
  • Posts: 9
  • Stealth Ranger
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #13 on: August 04, 2017, 09:28:08 AM »

Would be great if the build time could be reduced. After all my config is not that slow.

I just tried it on my pretty plain stock A1200/Blizzard1260/HDD config, and building a Hello, world! takes about 22 seconds (with Alb42's FPC nightly from yesterday), with about half of that spent in vlink. Frank Wille at some point added some optimizations to vlink, so the linking became a lot faster, I wonder if those are still in. Actually, if I'm correct, vlink uses some linked lists in the memory to build structures it then uses for final linking. I also verified and it didn't use any emulated instructions (long MUL or so) on the '060, so that can't be the source of slowness, but your slower RAM might be, although it certainly doesn't explain it fully.

BTW, I even tried to download the latest nightly vlink, and it didn't cause a performance difference in this case.

(Just for the record, under NetBSD/m68k the same machine builds Hello, world! in about 10 seconds with FPC, but that uses recent GNU as and ld, which are unavailable for AmigaOS.)
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #14 on: August 04, 2017, 12:35:25 PM »

Would be great if the build time could be reduced. After all my config is not that slow.

I just tried it on my pretty plain stock A1200/Blizzard1260/HDD config, and building a Hello, world! takes about 22 seconds (with Alb42's FPC nightly from yesterday), with about half of that spent in vlink. Frank Wille at some point added some optimizations to vlink, so the linking became a lot faster, I wonder if those are still in. Actually, if I'm correct, vlink uses some linked lists in the memory to build structures it then uses for final linking. I also verified and it didn't use any emulated instructions (long MUL or so) on the '060, so that can't be the source of slowness, but your slower RAM might be, although it certainly doesn't explain it fully.

BTW, I even tried to download the latest nightly vlink, and it didn't cause a performance difference in this case.

(Just for the record, under NetBSD/m68k the same machine builds Hello, world! in about 10 seconds with FPC, but that uses recent GNU as and ld, which are unavailable for AmigaOS.)

Hi.

Thanks for replying.

I've ran some tests on my A1200 ACA1233@40 and on the A600 VampireV2.
It really seems that vlink operates a lot in RAM and a fast (or slow) RAM is having a large effect on the time this takes.
In which case my A1200 with the relatively fast RAM is actually faster than my A4k with 060 CPU.
Here are some numbers:

I've taken some more build time measurements:

FP-3.1.1:
----------
HelloWorld
- A1200 ACA1233@40MHz: 25.6s
- A600 VampireV2:               6.5s
Windowtest
- A1200 ACA1233@40MHz: 79.9s
- A600 VampireV2:             19.9s

FP-Nightly:
------------
HelloWorld
- A1200 ACA1233@40MHz: 31.8s
- A600 VampireV2:             13.7s

Windowtest
- A1200 ACA1233@40MHz: 102.6s
- A600 VampireV2:               38.7s


What interesting is that the build time on the nightly is slower, by factor 2 on the Vampire.
Yes, I know the resulting binary is pretty much 10x smaller, so that's a large improvement, but on those 'slow' systems build time matters a lot.

So yes. If I like it or not, my A1200 is a lot faster than my A4k even if the CPU faster by factor ~3.


Manfred
Logged
Pages: [1] 2 3