Author Topic: Measuring Size of qb64 program  (Read 299 times)

Offline Dimster

  • Seasoned Forum Regular
  • Posts: 381
Measuring Size of qb64 program
« on: September 14, 2020, 08:51:17 AM »
I'm in the process of buying a new desktop computer. It's been a while and the choices of chips and drives is a little daunting. I'm thinking of getting an SSD & HHD combo. The SSD comes in varying sizes which has me thinking about the size of the program I'm writing. It's a rough spaghetti type, lots of subs and functions over 15000 lines of code. (I do expect the finished produce to be 1/2 that size). To measure the size of a qb64 program would the rule of thumb be 40 lines = 1k ?

Offline BSpinoza

  • Newbie
  • Posts: 49
Re: Measuring Size of qb64 program
« Reply #1 on: September 14, 2020, 09:58:18 AM »
My 3300 lines program has 118 kB. => 40 lines have 1.4 k.
The .exe is 2428 kB.
"Ich sage euch: man muss noch Chaos in sich haben, um einen tanzenden Stern gebären zu können. Ich sage euch: ihr habt noch Chaos in euch." (from Friedrich Nietzsche: "Also sprach Zarathustra")

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2752
    • Steve’s QB64 Archive Forum
Re: Measuring Size of qb64 program
« Reply #2 on: September 14, 2020, 10:03:30 AM »
All that would depend on the programmer’s personal coding style.

Joe codes like this:

PRINT
PRINT
PRINT “foo”

Fred codes like this:

PRINT ‘a blank line for ease of readability
PRINT ‘another blank line, same as above
PRINT “foo” ‘this line prints foo to the screen, so we have visible output


Now, Joe might be able to say 100 lines = 1k disk space, but that’s definitely not going to hold true for Fred.

(Or for Colon Pete!  PRINT: PRINT: PRINT “foo”. Pete tries his best to stack code on the same line, so those lines take up as much screen as possible.)

You might analyze your own code and see what the average letter count is per line, but you’ll never have a clue what another person’s is.

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Seasoned Forum Regular
  • Posts: 381
Re: Measuring Size of qb64 program
« Reply #3 on: September 14, 2020, 10:13:21 AM »
So would it be more accurate to be 1000 characters = 1k . I'm thinking just as a guide.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2752
    • Steve’s QB64 Archive Forum
Re: Measuring Size of qb64 program
« Reply #4 on: September 14, 2020, 10:34:57 AM »
So would it be more accurate to be 1000 characters = 1k . I'm thinking just as a guide.

That'd be a better way of thinking, though I'd guess at 900 characters = 1k.  (Invisible characters like the CRLF are appended to the end of each line, which you'd have to account for.  In Windows, that's 2 bytes per line.  Every other OS is 1 byte per line, so more characters per k.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Seasoned Forum Regular
  • Posts: 381
Re: Measuring Size of qb64 program
« Reply #5 on: September 14, 2020, 10:39:10 AM »
Thanks Steve and BSpinoza. That's very helpful.

Offline bplus

  • Forum Resident
  • Posts: 5219
  • B+ Knot again!
Re: Measuring Size of qb64 program
« Reply #6 on: September 14, 2020, 11:00:57 AM »
You know your source code, .bas, txt files are a fraction of what the .exe is going to be and all the sound and image files that come with a project.

I wouldn't worry about bas files when buying a computer, they are nothing overall. I have thousands and they hardly make a dent in hard drive.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2752
    • Steve’s QB64 Archive Forum
Re: Measuring Size of qb64 program
« Reply #7 on: September 14, 2020, 11:27:46 AM »
You know your source code, .bas, txt files are a fraction of what the .exe is going to be and all the sound and image files that come with a project.

I wouldn't worry about bas files when buying a computer, they are nothing overall. I have thousands and they hardly make a dent in hard drive.

Aye.  To put it in perspective, QB64.BAS is about 25,000 lines, and comes in at just about 1MB of disk space.  Cyberbit.TTF -- the unicode font which we include with QB64 by default, comes in at over 13MB in size.

By that average, you'd need to write 325,000 lines of code to take up the same amount of disk space as a single font file!!

And, if you select system properties and right click the "Compress contents to save disk space" option for your folder, BAS files compress down by usually 95-99%.  (They're pure text, and text compresses like crazy!)

With one change to the folder settings, you now would need 32 million lines of code to take up the same amount of drive space as a single font!

Which leaves me to agreeing with bplus, completely:

I wouldn't worry about bas files when buying a computer, they are nothing overall.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Seasoned Forum Regular
  • Posts: 381
Re: Measuring Size of qb64 program
« Reply #8 on: September 14, 2020, 12:00:35 PM »
Oh...BSpinoza .exe  was 2428 kb's . I eventually expect my finished program to be stand alone. So just projecting his 3300 lines, 2428 .exe to a potential 10000 lines of  code has me thinking the final product could be significant in size. So very handy to get more perspective, thank you. This could save me $$$$ in the build of the new compute.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2752
    • Steve’s QB64 Archive Forum
Re: Measuring Size of qb64 program
« Reply #9 on: September 14, 2020, 12:16:21 PM »
Oh...BSpinoza .exe  was 2428 kb's . I eventually expect my finished program to be stand alone. So just projecting his 3300 lines, 2428 .exe to a potential 10000 lines of  code has me thinking the final product could be significant in size. So very handy to get more perspective, thank you. This could save me $$$$ in the build of the new compute.

Not really.  A simple “Hello World” program compiles to about 2.2MB in size, with QB64, as it includes all sorts of commands and functions in its connected libraries.  His 3300 line program is only a few hundred kb larger than just compiling a PRINT “Hello World”.

Again, another extreme point of reference is QB64.EXE itself.  Compiled from a source which is over 100,000 lines, it comes in at about 7MB in size...

So with 2MB per EXE as minimal size, we can guess that every 20,000 lines adds approximately 1MB to the EXE’s final size.

Which is still quite a bit less than the size of the font file we ship as a resource, by default...

If I wanted a rough guesstimate of disk space — not counting resource files for my programs — I’d say 100kb, on average, per program, and 3MB, on average, for program + EXE.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Richard Frost

  • Forum Regular
  • Posts: 181
  • Needle nardle noo. - Peter Sellers
Re: Measuring Size of qb64 program
« Reply #10 on: September 14, 2020, 05:21:49 PM »
The source of two of my bigger programs average 1.7 and 1.9K per 40 lines, not counting blank lines.
If I include the blank lines, it's 1.6 and 1.7, and I never use multiple blank lines.

It was easy for me to calculate these numbers, because I wrote a program to read source files and
report on all sorts of things - total non-blank and non-comment lines, lines with more than one command,
lines per SUB sorted by size, etc.

I currently have 610 .bas files totalling 14 megs.  A single music video downloaded from YouTube is
bigger than that!  Not all of them are compiled.  Those that are total 360 megs - again negligible
even for small modern hard drives. 

It works better if you plug it in.

Offline Cobalt

  • Forum Resident
  • Posts: 657
  • At 60 I become highly radioactive!
Re: Measuring Size of qb64 program
« Reply #11 on: September 14, 2020, 07:08:27 PM »
Get what you can afford

The exe basically starts at 2.2megs like Steve said, but even Dragon Warriors exe wasn't much bigger for ~300k(318,566)bytes of code at 3.5megs. but with sound and video the exe gets a little larger with all the extra baggage that comes along with them.

As B+ said, think more about the audio and GFX your going to be dealing with more than your code.
Granted after becoming radioactive I only have a half-life!

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 2381
  • LET IT = BE
    • QB64.org
Re: Measuring Size of qb64 program
« Reply #12 on: September 14, 2020, 07:10:00 PM »
If you're getting an SSD+HDD combo, you don't have to worry about the size of the SSD for your own files, as you'll probably keep the SSD for the OS and applications, while your documents and files will remain in the HDD. That's usually the drill, isn't it?

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 356
Re: Measuring Size of qb64 program
« Reply #13 on: September 14, 2020, 07:44:07 PM »
Excluding white space, of which I use quite a bit, my obsession comes in at a tad under 4000 lines. I also try to comment pretty heavy on important projects so I can pick up after long hiatuses (hiati?). The .bas is presently 213K and compiles to 3.4-3.5 megs.

By comparison, my hex grid drawing program has a line count of 26 with very little in comments, a .bas size of 1K and compiles at a little over 2 megs. Over half the size of the big boy!

As Steve and Bplus noted, the .bas has very little impact and even a small quickie program compiles with a lot of overhead.
Andy

Offline Dimster

  • Seasoned Forum Regular
  • Posts: 381
Re: Measuring Size of qb64 program
« Reply #14 on: September 15, 2020, 11:00:16 AM »
I very much appreciate all the info and examples. Originally I was thinking 1tb SSD and 1tb HHD but clearly a smaller SSD would be fine. I was also thinking of the cheapest graphics card to work with any qb64 graphics. If I'm wrong and at least middle of the road graphic card is the better route, would that choice put constraints on the size of the SSD? Can you tell I have never custom ordered a computer before, just walk in and walked out of a store with one in hand.

Seems I've focussed this topic more on hardware than programming but qb64 has been taking a lot more of my time on the computer than any of the other tasks it does for me and if I can slant the new one to be more productive and faster and more accurate then nows the time to do it.