How to reduce file size?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Vernostonos
User
User
Posts: 58
Joined: Thu Jul 02, 2020 9:52 pm

How to reduce file size?

Post by Vernostonos »

Are there any tricks for keeping file size down for a PB project?
I just hit 101 kb and have only half of my character creation system finished. I'm worried once all the dialog, custom fonts, and locations are completed its no longer going to fit on a 1.44mb floppy.
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Re: How to reduce file size?

Post by jack »

for executable or dll you could use UPX https://upx.github.io/
however, some AV will probably give a false positive on exe's packed with UPX
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: How to reduce file size?

Post by Josh »

Vernostonos wrote:... its no longer going to fit on a 1.44mb floppy.
Excuse me, it's the year 2020.
sorry for my bad english
User avatar
Demivec
Addict
Addict
Posts: 4090
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: How to reduce file size?

Post by Demivec »

Vernostonos wrote:Are there any tricks for keeping file size down for a PB project?
I just hit 101 kb and have only half of my character creation system finished. I'm worried once all the dialog, custom fonts, and locations are completed its no longer going to fit on a 1.44mb floppy.
If it is just for the storage of your portable working files I would suggest using a thumb drive. Is there any reason why you would be limited to only a 1.44 mb floppy?

If it is for the executable that you will produce from the project then a smaller file that loads and uncompresses the main file before running it may be the way to go.
BarryG
Addict
Addict
Posts: 3322
Joined: Thu Apr 18, 2019 8:17 am

Re: How to reduce file size?

Post by BarryG »

jack wrote:some AV will probably give a false positive on exe's packed with UPX
That doesn't happen anymore. The AV just unpacks it. Packed/unpacked is the same AV results. I've done LOTS of tests in this area.
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: How to reduce file size?

Post by leonhardt »

You care about the exe size which made by PB? :shock:
poor English...

PureBasic & Delphi & VBA
Rinzwind
Enthusiast
Enthusiast
Posts: 638
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: How to reduce file size?

Post by Rinzwind »

You will find that as long as you do not need additional PB libraries, the file will not grow much. The libraries is what increases the size. Unless you have a ton of text in your file (maybe compress/uncompress at runtime). But I would wait with that till completion and only if necessary... If that's the case, then the text should move to an external file anyway to simplify maintenance or even translation.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: How to reduce file size?

Post by Mijikai »

Use 'bits' or the BriefLZ packer to grunch down fonts and graphics.
Break down your code in procedures -> reuse code as often as possible.
Use ascii when storing strings - unicode is a waste.

Good luck :)

Edit:
I really like such projects and i totally see that u need the floppy.
Having the fastest and smallest code possible is a lost virtue.
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: How to reduce file size?

Post by Bitblazer »

What is your software supposed to do? What is your target operating system?
Mijikai wrote:Having the fastest and smallest code possible is a lost virtue.
The good old times of manipulating exe headers to save a few bytes on disk ;) I remember some people invented their own assembly language for size competitions done by Hugi.
normeus
Enthusiast
Enthusiast
Posts: 415
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: How to reduce file size?

Post by normeus »

Why are people replying to a post from last century?
Usually spam bots respond to those. :D :D

I had trouble loggin, in to post this. It gave me a "too many failed attempts" error so there are spammers trying to hack into the Forum.

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
BarryG
Addict
Addict
Posts: 3322
Joined: Thu Apr 18, 2019 8:17 am

Re: How to reduce file size?

Post by BarryG »

normeus wrote:Why are people replying to a post from last century?
What? This thread is only a day old.
User avatar
NicTheQuick
Addict
Addict
Posts: 1226
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: How to reduce file size?

Post by NicTheQuick »

Mijikai wrote:Having the fastest and smallest code possible is a lost virtue.
It's not always the smallest code that is the fastest. In fact many codes can be made faster when you use a better and also bigger structure and better algorithms. Compare Bubblesort with Quicksort.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: How to reduce file size?

Post by leonhardt »

NicTheQuick wrote:
Mijikai wrote:Having the fastest and smallest code possible is a lost virtue.
It's not always the smallest code that is the fastest. In fact many codes can be made faster when you use a better and also bigger structure and better algorithms. Compare Bubblesort with Quicksort.
+1,general rules in programming,either room,or speed.
poor English...

PureBasic & Delphi & VBA
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: How to reduce file size?

Post by Mijikai »

NicTheQuick wrote:It's not always the smallest code that is the fastest. In fact many codes can be made faster when you use a better and also bigger structure and better algorithms. Compare Bubblesort with Quicksort.
Do you think they did not know that, whats your point?
Hardware has changed drastically so there is not the same incentive/requirement anymore to get the best result in both areas.
User avatar
NicTheQuick
Addict
Addict
Posts: 1226
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: How to reduce file size?

Post by NicTheQuick »

Mijikai wrote:
NicTheQuick wrote:It's not always the smallest code that is the fastest. In fact many codes can be made faster when you use a better and also bigger structure and better algorithms. Compare Bubblesort with Quicksort.
Do you think they did not know that, whats your point?
Hardware has changed drastically so there is not the same incentive/requirement anymore to get the best result in both areas.
Of course not all programmers know that. That's the reason I wanted to point that out more specifically. It's just not true, that's all.

But I agree that today's code bases often are way more bloated then their need to be. So in general you need the right balance to use CPU caches, branch predictions and the best instructions the CPU has to offer in a efficient way. Of course, on small microcontrollers with 1 MB of flash memory or less you need to look at each bit individually to get the smallest executable possible. But that's a totally different way of programming than on modern computers with more Cache than these microcontrollers have memory available. :D
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply