Page 1 of 1
Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Wed Mar 06, 2024 10:49 am
by BarryG
I just removed the last ASM commands in my big app (over 60,000 lines) but when I try to compile with the Beta 7 C backend, it just sits there saying "Compilation in progress" for ages. It's been a few minutes so far but I'm letting it go to see how long I need to wait. With the ASM backend, it compiles in about 10 seconds. I turned off Windows Defender for the test, too.
[Edit] The exe finally finished compiling and successfully ran!

But yeah, it took about 3 minutes vs 10 seconds for the ASM backend. What to do? Turning off code optimization didn't help, and neither did changing "pbcompilerc.exe" to High priority with the Task Manager. I also noted the CPU use in Task Manager for "pbcompilerc.exe" doesn't change at all (and neither does its memory use), so it's like the process is doing nothing for ages?
Also, I tried compiling with the C backend again just now and got this error this time, which didn't occur the first time I compiled with C, and doesn't ever occur when compiling with ASM:
[Edit 2] Tried again in C and this time it compiled without a missing include file error? Weird.
Also happy to report my exe size with ASM is 8.19 MB but with C it's only 6.78 MB. Nice!

Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Wed Mar 06, 2024 2:20 pm
by Fred
Such time isn't unusual for C backend with big programs, that's why ASM backend can still be useful. Which CPU did you got ?
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Wed Mar 06, 2024 9:13 pm
by STARGÅTE
I had the same experience here.
One of my largest project has 70k lines. In the ASM backend it complies in 2 s, good time for development.
When I switch to C backend (without optimization) it takes 14 s and with optimization 35 s, both not ideal for development.
So currently I use only the ASM backend during coding, and only for release compilation I switch optionally to the C backend.
So having both, the ASM backend and C backend in Pure Basic, is a very great feature of Pure Basic.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Thu Mar 07, 2024 1:43 am
by BarryG
Fred wrote:Such time isn't unusual for C backend with big programs, that's why ASM backend can still be useful. Which CPU did you got ?
It's a very old PC. Task Manager says AMD A10-7800 Radeon R7, 12 Compute Cores 4C+8G, running at 3.50 GHz.
STARGÅTE wrote:When I switch to C backend (without optimization) it takes 14 s and with optimization 35 s, both not ideal for development.
What? I'd kill for those speeds!

Waiting 3 minutes to create an exe is disappointing, but I get it. Not Fred's fault.
STARGÅTE wrote:I use only the ASM backend during coding, and only for release compilation I switch optionally to the C backend.
I might do that, too. Not sure yet. I kinda want to keep using this ->
https://www.purebasic.fr/english/viewto ... 53#p584753
@Fred: What about that missing resource file bug in the screenshot above?
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Thu Mar 07, 2024 12:04 pm
by Fred
I need a code + step to reproduce the manifest error
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Thu Mar 07, 2024 12:09 pm
by BarryG
Never mind, then. I can't share 60K of code and hundreds of support files needed to compile it. The error only happened once so far, anyway.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 2:04 am
by skywalk
I agree the C compilation is slower, but I am well under 60sec for ~70k loc. I don't know if the counter subtracts commented lines? Haha
BarryG - With compile times so high, did you consider compiling your libs separately as DLL's? You would have to declare prototypes, but the compile time would be reduced.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 2:16 am
by BarryG
I don't want separate DLLs to be shipped with my standalone exe, if that's what you mean? I'll just keep using ASM after all, I think.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 2:42 am
by skywalk
I agree. The other option is static libs.
That is the last domino to fall with PB 6.xx. I would jump on user static libs when Fred approves the approach.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 12:16 pm
by Caronte3D
BarryG wrote: Fri Mar 08, 2024 2:16 am
I'll just keep using ASM after all, I think.
I always compile with the ASM backend while coding, then use the C backend for the final version

Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 1:01 pm
by BarryG
I know, but I'd still prefer to use what you posted here ->
https://www.purebasic.fr/english/viewto ... 53#p584753
But looks like I may have to forgo it if I use the C compiler for releasing updates.
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Fri Mar 08, 2024 1:35 pm
by Caronte3D
Not the same, but...
I use this obfuscator to hide the most delicate texts:
https://www.purebasic.fr/english/viewto ... ck#p546341
Re: Slow to compile with 6.10 Beta 7 with C vs ASM
Posted: Sat Mar 09, 2024 2:17 am
by BarryG
Hmm, not quite what I want to use (too much work). The ASM solution is fantastic because I don't need to change or do anything.