It is currently Fri May 24, 2013 9:59 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 7:53 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Hi.
I just got a new i7 laptop (so 5400 rpm hd), and compared to my macbook air core2duo (ssd) it compiles in about the same time.
The compile time actually bugs me a lot.
Why does it take time?
Is it because of CPU usage? (not so sure, because the i7 would be faster in that case)
Or is it because of disc use? (not so sure either, because the macbook would be faster in that case)

Is there any smart way of getting the compiletime down?
Ramdisc? Use multiple cores in the compiler? Any ideas?


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 8:52 am 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1024
How big is the source you want to compile?
I never had problems with the compile speed of PB, it's actualy pretty fast because it does not do a lot of optimizations to the code and compiles in a single pass.

You could try to split your project in modules that you compile to DLL's or libs, so you dont need to compile the whole project every time you change something.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 8:57 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
My code is 30k lines or so, devided into 12 files thats included. There is also some includes. End .exe file is about 2-3mb.
Don't get me wrong. Its not slow. Visual studio is the type where you can put your coffee maker on, wait for it, drink your coffe and then your application is done. PB is more like you can look at the newspaper, facebook and PB forum and then your application is done.
Gfabasic32 that i used to work with always compiled in no time (nomatter size of exe or includes) - but that had all files at hand (no need to load a compiler, no need to write a ASM file, no need to reload the includes)


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 9:42 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 24, 2008 12:21 am
Posts: 256
My project is currently around 30-35k lines of code and it compiles in max. 3 seconds. And I only use a low budget notebook.
There seems something wrong with your setup?

_________________
pb 5.11


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 10:42 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 8876
Location: France
do you include some binary data to end up to 2-3 mega for 30k lines ?


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 11:13 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Yep. Its about a dussin PB files and then several small png files.
I might be extremely fast reading the newspaper... I am not in any way dissatisfied, this is more a general discussion for me - is there any way of making it faster?


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 2:45 pm 
Offline
Addict
Addict

Joined: Sat Oct 17, 2009 10:51 pm
Posts: 919
Exaggerated compile times are usually down to a nefarious AV (or other such program) trying to do things it should not be doing.

_________________
If you are new to PB you should check out the CodeArchiv. It has examples for almost everything you would want to do in PB.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 4:51 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1386
Location: Boston, MA
What compiler options do you use?
I've noticed small differences with and without unicode selected.
And if it is your 1st compile after opening IDE.
And if debugger is on.
3 - 10 sec for 20k lines on Windows 7 SP1 x86.
Same code on XP compiles faster in general regardless of slower general processor.
So, it definitely implies a lot of interaction with Antivirus and OS and hard drive access times...

Still, you must be quite the speed reader to finish a newspaper before compile time. :wink:

_________________
To understand recursion, you must first understand recursion. ~ unknown
I never make stupid mistakes. Only very, very clever ones. ~ John Peel


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 6:15 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1024
jesperbrannmark wrote:
is there any way of making it faster?

As i wrote, split it in modules you compile seperatly.
Instead of including many includes, make DLL's of them so they are not compiled if you compile the main source.
Thats the only way i can think of to speed it up.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 7:15 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
I'm not sure DLL are the way to go, I would never do that anyway.
However, this can be a great way to improve PB's compiler! compile to static libs each files, and only re compile it if the file has change :)


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 7:46 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1024
Polo wrote:
I'm not sure DLL are the way to go, I would never do that anyway.
However, this can be a great way to improve PB's compiler! compile to static libs each files, and only re compile it if the file has change :)

On the compiler side it even doesnt need to be static libs, just object files. It's a common compile speed optimization used by a lot of compilers.
However that does not help jesperbrannmark because he cant change the compiler. :wink:

And why not use DLL's?


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 7:50 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
Thorium wrote:
Polo wrote:
I'm not sure DLL are the way to go, I would never do that anyway.
However, this can be a great way to improve PB's compiler! compile to static libs each files, and only re compile it if the file has change :)

On the compiler side it even doesnt need to be static libs, just object files. It's a common compile speed optimization used by a lot of compilers.
However that does not help jesperbrannmark because he cant change the compiler. :wink:

And why not use DLL's?

True, but if Fred do that in the future that'd be brilliant! :)
I'd not use DLLs just because it means bigger overall size, plus I'd rather have a single file, it's just cleaner and look/is less bloated :)


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 7:58 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1024
Polo wrote:
True, but if Fred do that in the future that'd be brilliant! :)
I'd not use DLLs just because it means bigger overall size, plus I'd rather have a single file, it's just cleaner and look/is less bloated :)

Yes, but i am sure Fred does know this technic.
So the question is how hard is it realy to implement. I guess it's not that easy because of the procedural nature of PB. On a OOP language it should be much easier to implement as you do have objects that can be seperated from each other. On PB everything can access everything from everywhere. So i guess it's a lot harder to build reusable object files out of the single PB files.

But i am not a expert on compiler development, i could be wrong.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 8:27 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
Same here, I don't know anything about that, but if that's possible that'd be a nice thing to have (although I'm much more waiting for the Cocoa subsystem on Mac than anything else :) )


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Wed Feb 22, 2012 8:41 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
Thorium wrote:
I guess it's not that easy because of the procedural nature of PB.

PB is like C in this case, but PureBasic always compiles one big source (with includes),
whereas C compilers can compile separate modules/files.
With modules only changed sources need to get compiled again to give the linker the latest .obj/.lib files for linking.

I think module support has already been requested.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye