It is currently Sat May 25, 2013 4:55 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Why does it take time to compile?
PostPosted: Thu Feb 23, 2012 3:50 am 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 218
Location: Brisbane, Qld, Australia
Regarding speed of compile, I'm very happy with it. :D I've just compiled my project of more than 152000 lines in 5 seconds (approx). The compiled executable is about 5Mb. The project has been converted (and enhanced significantly) from VB6, and compiling the original version in VB6 on the same machine takes about 25 seconds and produces an 8Mb executable.

_________________
Mike


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Thu Feb 23, 2012 4:28 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1387
Location: Boston, MA
I think you're comparing PB compile to VB6 run/interpret?
~20k lines in VB6 took at least 3 minutes to compile an executable, where PB is close to 15 sec. :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: Thu Feb 23, 2012 5:25 am 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 218
Location: Brisbane, Qld, Australia
On my Win7 machine (4GB, 2.27GHz dual core) at takes VB6 about 25 seconds to 'compile to native code' my old VB6 project.

However, my point is that with my project, compiling in PB is much faster, and with this crude time estimate (based on watching the second hand on my watch) VB6 takes about 5 times as long to compile as PB.

_________________
Mike


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Thu Feb 23, 2012 7:53 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Ok. I like this discussion, its about making PB better and better (its already in awsome status...). I started it, and next time i compiled i got a out of memory. well. a reboot and now i compile in 1 second. Not on the mac though where its 15 seconds, which is enough time for me to read the newspaper, take a dump and look at facebook... :lol:


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Thu Feb 23, 2012 9:43 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 8876
Location: France
On the mac, we use the build in assembler 'nasm' instead of 'fasm' (which is know to be the fastest assembler around) which could be the difference between mac and windows.


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

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
Fred wrote:
On the mac, we use the build in assembler 'nasm' instead of 'fasm' (which is know to be the fastest assembler around) which could be the difference between mac and windows.


Fred,
are there any plans to move away from fasm on the other platforms?

Creating proper static libs instead of using TailBite comes to mind...

bye


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Thu Feb 23, 2012 11:12 pm 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1460
Nowhere in this thread is any specific information about the sources being compiled and what they're actually doing. Therefore, claiming PureBasic to be "slow" at compiling is misleading and possibly off-putting to potential buyers who may be lurking. Saying something is "slow" without details is totally unfair. It could even just be your PC for all we know.

So, I say: give us more specifics about your sources, Jesper, and what they're doing. What files they're including, and whether they're being generated by a pre-processor, and whatever else is relevant. Your PC's stats. Are you running an anti-virus, etc. Not just "it's slow, can you make it faster".

You said your sources are around 30 KB and you have time to read this forum during compilation. That points to something else being the bottleneck, and not the compiler. For comparison, I have an old dual-core PC running Win XP and I can compile a 568 KB source in about 3 seconds, and that's with my source also including another 12 KB source, and also including 70 x 2 KB icons and 5 x 3 KB wav files. That ain't slow to me by any stretch of the imagination.

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 8:00 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
I love PB.
My inital question was what is it that takes time to compiler? Is there any bottleneck that can be avoided?
Like if I could speed up using a RAMdisc instead of normal disc?
Like if I could preload something that would speed things up?
I saw this thread as more a discussion on what I could do to speed up my system.
I think we got some good ideas here - precompiling parts of my libraries etc.
I might do some tests with RAMdisc instead of normal disc for temp and compiler...
PB rocks !


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 2:10 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 794
There are several steps for a compiler, and the number of steps varies depending upon the complexity. Each step consumes time. They are not merely "lookup tables".

I'm guessing that PB is a recursive descent, which is the easiest to write by hand. The first step it does is recognize the "words" in the file. This is called tokenizing. For instance, when it first opens the file, is the first character it sees a semi (comment), a hash (constant), or a letter (var or func call)? Some tokenizers read a whole word (characters until a "separator" char is found). After the word is tokenized, the compiler determines what to do (skip the comment, use the constant, or call the func). During this final handling, "output code" is produced. More sophisticated compilers use an intermediate code so it can be optimized more efficiently after code generation has completed. There is reason to believe that PB just goes straight to asm. The compiler just repeats these steps until the file is done.

A more complicated compiler may run multiple passes on the input file. For instance, a two-pass compiler might use the first pass to recognize all of the variables and constants, and a second pass to do the rest. This allows for referencing a function or constant that has not yet been defined, or implementing a preprocessor as in C.

A common next step is the optimizer, if the system has one. I can't tell if PB has one or not; it may simply have efficient asm output, or it may run a rudimentary optimizer. Just like compilers, optimizers vary greatly in complexity; some run in one pass, some in two or more.

Next comes the assembling. This is basically done the exact same way as compiling, except assemblers are much less sophisticated (they have fewer rules, and tighter constraints) so it can go faster. Also, instead of readable code for output, the assembler generates binary code. Assembling is simple enough that it can merely be a lookup table type program, although they are generally not.

Just as a "gut feel" comparison, I am guessing that the Gnu Assembler takes about 5 times as long to assemble a file as the Fasm assembler that PB uses. I don't know why it is so slow, but I can tell you that it is horribly inefficient with macros.

Anyway, back to your "how can I make it faster" question. In reality, aside from precompiling libraries, there is not much you can do. That will save you from repeatedly compiling code that is not being edited.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 5:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Apr 04, 2006 6:27 am
Posts: 308
Kuron wrote:
Exaggerated compile times are usually down to a nefarious AV (or other such program) trying to do things it should not be doing.


I agree, that and badly setup computers. That must be the case here as both Visual Studio (2010) and PB compiles in a few seconds under correct conditions.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 7:05 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
X wrote:
Kuron wrote:
Exaggerated compile times are usually down to a nefarious AV (or other such program) trying to do things it should not be doing.


I agree, that and badly setup computers. That must be the case here as both Visual Studio (2010) and PB compiles in a few seconds under correct conditions.

Not on OSX - without any AV or such, obviously.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 7:59 pm 
Offline
Addict
Addict

Joined: Sat Oct 17, 2009 10:51 pm
Posts: 919
Polo wrote:
Not on OSX - without any AV or such, obviously.
What does OSX have to do with the OP who is complaining about the compile time on his new i7 laptop?

The only mention of a Mac is in comparing compile time of the new system to his old Macbook.

Not a lot can be done for suggestions since the OP is not telling us which version of Windows he is running on his new system.

_________________
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: Fri Feb 24, 2012 11:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Well. No this was my fault. If I get a windows computer and dont reboot it in two weeks everything will be slow - i rebooted and its all good.
The macbook air however (core2) is slow. This however was very good explained before - using nasm instead of fasm. I think xcode probably also play a role here.
Tenaja had a great post on the steps on compiling. Working with strings is slow, no doubt about it. I remember GFA32 usually saved the source as a binary code instead of the actual string (like messagerequester would not be that but INT(1049) or something in the binary file). However I am glad PB doesnt do that due to compatibility and future uses.
Putting compiler and stuff in ramdisc would not be an option on macbook air, since its already SSD. I has been going slower and slower lately. I might just look into what I can do to speed the MBA up, its proably a general computer thing.


Top
 Profile  
 
 Post subject: Re: Why does it take time to compile?
PostPosted: Fri Feb 24, 2012 11:39 pm 
Offline
Addict
Addict

Joined: Sat Oct 17, 2009 10:51 pm
Posts: 919
jesperbrannmark wrote:
I might just look into what I can do to speed the MBA up, its proably a general computer thing.
Being a Mac, it probably doesn't have enough RAM in it.

I can't speak for the Mac version of NASM, but on Windows, NASM is not a bottleneck. I have been using one language for years that uses NASM. Very speedy compile times.

_________________
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: Mon Feb 27, 2012 12:19 pm 
Offline
Addict
Addict

Joined: Sun Aug 08, 2004 5:21 am
Posts: 1088
Location: Netherlands
FASM on OS X seems to be possible but complicated
http://board.flatassembler.net/topic.php?t=9954


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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