Slow to compile with 6.10 Beta 7 with C vs ASM

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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! :D 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:

Image

[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! :D
Fred
Administrator
Administrator
Posts: 18164
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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 ?
User avatar
STARGÅTE
Addict
Addict
Posts: 2228
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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! :o 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?
Fred
Administrator
Administrator
Posts: 18164
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post by Fred »

I need a code + step to reproduce the manifest error
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4213
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4213
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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 :wink:
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post by Caronte3D »

Not the same, but...
I use this obfuscator to hide the most delicate texts:
https://www.purebasic.fr/english/viewto ... ck#p546341
BarryG
Addict
Addict
Posts: 4160
Joined: Thu Apr 18, 2019 8:17 am

Re: Slow to compile with 6.10 Beta 7 with C vs ASM

Post 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.
Post Reply