Slow code generation when using -gen gcc -g -R (SOLVED)

General FreeBASIC programming questions.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Slow code generation when using -gen gcc -g -R (SOLVED)

Postby AGS » Jul 06, 2014 17:15

I've created a file that consists of nothing but one line macros that look like this

Code: Select all

#define identifier hexadecimal_number


When using the assembler back end the compiler reports that creation of the .asm file took 0.2 seconds.
Using the time utility I get a total time of execution (time fbc -g -R filename.bas) of 0.4 seconds (using msys on win32).

When using the gcc back end things are different. Again the compiler reports 0.2 seconds as total compilation time.
The time it takes to generate a binary is much longer. I get a total time of execution (time fbc -gen gcc -R -g) of 20 seconds.
Which is nowhere near the 0.2 seconds it takes to turn the fb code into C code (and much slower than what I get when
using the assembler back end).

If I use -gen gcc without the option -g performance is much, much better (about the same as I get when using the asm back end).

I am using
fbc version 0.90.1 on win32 (os: win7 64bit pro)
gcc version 3.4.5 (mingw-vista special r3).


I don't think the c back end is causing the slow compilation times (generating the C code does not take all that long) so the problem must be with mingw.

Could someone verify that compilation takes less time when using a newer version of mingw (or when using gcc on Linux)?
fbc command line options to use: -gen gcc -g -R

Source code (file consisting of many a macro definition) can be downloaded from
http://www.sarmardar.nl/FreeBASIC/unicodedata.bas
Last edited by AGS on Jul 08, 2014 17:48, edited 1 time in total.
dkl
Site Admin
Posts: 3212
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Slow code generation when using -gen gcc -g -R (many mac

Postby dkl » Jul 07, 2014 10:30

I think the problem is fbc itself, after seeing that when testing with -v it hangs at the "compiling" step for 50 seconds before even reaching the "compiling C" step.

It's unusually slow with -gen gas too, so it's probably related to the compiler creating 30k AST nodes holding line number information under -g and then not dealing with that nicely. For -gen gcc profiling showed it spends 99% time (36 seconds) in fb_StrConcat(), that's pretty sad, so the code in ir-hlc.bas apparently is pretty bad, at least for -g.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: Slow code generation when using -gen gcc -g -R (many mac

Postby AGS » Jul 08, 2014 17:46

I'm going to mark this subject SOLVED.

And thanks for taking the time to check the problem out, dkl.

Return to “General”

Who is online

Users browsing this forum: Bing [Bot] and 14 guests