PureBasic is really smaller than C++ (this is the proof)

Everything else that doesn't fall into one of the other PB categories.
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

PureBasic is really smaller than C++ (this is the proof)

Post by merendo »

First I didn't really believe, but this proof kills all of my doubt: PureBasic executables are really smaller than C++ ones.

This is the proof, compare!

A simple 'Hello World' in a console

C++
EXE (74752 Bytes)
Source

PureBasic:
EXE (7200 Bytes, less than a tenth of the cpp exe)
Source

Cool 8) 8) 8)

Bye! merendo
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Yes, but...

Post by Hi-Toro »

Don't get me wrong, I love PB's tiny executables, but in fairness, I have to ask what C/C++ compiler was used, and with what settings? I'm assuming you're probably talking about Visual C/C++ with default settings, but take a look at this page anyway:

http://freespace.virgin.net/james.brown ... minexe.htm

Small exes are possible in C/C++ but require some manual work to achieve... me, personally, I couldn't be bothered with all that -- gimme PB simplicity any day!

(Just thought I'd point it out as I used to think it wasn't possible for VC to output small executables!)
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Merendo, in a normal use of programming C or C++ and Purebasic, you will always get very much smaller size in PureBasic executeables.
Mostly due to Includes, which are always required under normal use of programming in C, C++.

Hi-toro say:
Small exes are possible in C/C++ but require some manual work to achieve...

Ok, but for sure it should be easier to do it all using pure assembler. :wink:


AL
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

78kb sounds big for an hello wold in C++. Here are my tests:

+ VisualC++ 6.0 SP4
+ Option: Release Mode, Optimise for size
+ Simple HelloWord in console mode

Result: 28 kb exe printing Hello World.

But it all depends of the compiler. DevC++ is known to do smaller exe too...
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Smaller still?

Post by Hi-Toro »

In the 3rd reply here, this guy claims a smallest working exe size of 1536 bytes, in VC6!

http://miataru.computing.net/programmin ... /5952.html

All that said, it's not like the difference between a 5k and a 35k app is that much of a problem these days...
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
sec
Enthusiast
Enthusiast
Posts: 792
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Re: Smaller still?

Post by sec »

Hi-Toro wrote:All that said, it's not like the difference between a 5k and a 35k app is that much of a problem these days...
i agree, as on my OS NT4:
filesize need align so: a file (8,814 bytes) are same (12,288 bytes) ,
12,288 is nearly 8,814 (that mod 512 =0) :P

So,i think(?) a smallest executable that run on NT4 need size 1024 (a header + a section) large in filesize on disk
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

I compiled the sourcecode of C++ using DevC++ 4.
The sourcecode is a template that comes with the compiler.
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Smaller still?

Post by Fred »

Hi-Toro wrote:In the 3rd reply here, this guy claims a smallest working exe size of 1536 bytes, in VC6!

http://miataru.computing.net/programmin ... /5952.html
It's an interresting post but if I understand correctly, it uses a compressor to reach this size. And the whole thing is very long and lowlevel to achieve it.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Heres a real test. A small tight C++ produced exe using just good coding practice.

http://www.relisoft.com/freeware/index.htm

The whole game is 280k, including graphics and sound effects.

Can PB produce something smaller?
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Yep:
http://freak.purearea.net/tools/

Have a look at the tetris game. 28kb (including 1kb icon)

I also did a multiplayer version which is 47kb, and each executable
contains the full client and server code. (still a bit buggy, but working)
get this here: http://freak.purearea.net/tools/TetrisNetwork.zip

Timo
quidquid Latine dictum sit altum videtur
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

If you use 'Sphinx C--' you get:
HelloWord.com = 53 bytes
HelloWord.exe = 1024 bytes (real Windows32 Console Application)

I know C-- is not really full blown C++, but you can already do classes now (native in compiler), and a OOP GUI library (wxWindows commands) is also available.

That's what I use if I play with C.

I am to provide the public with beneficial shocks.
Alfred Hitshock
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

It's an interresting post but if I understand correctly, it uses a compressor to reach this size.
No, he just says that those things might be more appropriate for larger applications. The executable in the example doesn't use a compressor.
And the whole thing is very long and lowlevel to achieve it.
Of course! It's more of a theoretical exercise (ie. make the smallest legitimate Windows exe, even if it doesn't actually do anything), but I thought it was worth posting as people often say VC++ can't create small executables when in fact it can.

Of course, I myself would *much* rather code in PB!

(I also noticed in one of the linked articles (I think the first one?) that there's a link to a M$ page that provides a miniature C lib that makes much smaller exes than normal -- you apparently just include that instead of the usual stuff, so it's not long and complex to use; probably just for command line apps though.)
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
wcardoso
User
User
Posts: 80
Joined: Fri Apr 25, 2003 5:06 pm
Location: Uruguay

Post by wcardoso »

I think the exe file size that a compiler generate is only one side of the picture. The whole picture have several sides like the comfort of the IDE, the easy syntax, the core of the language with the comand set, the GUI elements included in the language and the integration with the WinAPI, etc, etc.
The PureBasic compiler have the perfect mix of all this features and for me it´s sufficient. :wink:
with love from Uruguay
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

ACK. Look at BlitzBasic apps. Even if the sourcecode is empty, the exe is at least about 500 KB big. But BlitzBasic is fast, just like PureBasic.

And I think one or two KB more or less are not important if the exe is fast and runs on all systems :)

PureBasic provides all of this.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

The most geeky thing I ever did see was a friend that showed me a 50 byte program he wrote in PIC assembly for a clock. Totally geeked me out!

BEAT THAT PUREBASIC!

hehe :-)
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply