reducing the source file,removing empty lines etc

GFA, ASM, STOS, ...

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2025
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

reducing the source file,removing empty lines etc

Postby charles » Tue Nov 07, 2017 11:11 pm

what benefits is there to eliminating empty lines and remarks from a source code before compilation?
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

Jeff_HxC2001
Captain Atari
Captain Atari
Posts: 305
Joined: Fri Sep 21, 2007 7:35 pm
Location: Paris - France
Contact:

Re: reducing the source file,removing empty lines etc

Postby Jeff_HxC2001 » Tue Nov 07, 2017 11:17 pm

charles wrote:what benefits is there to eliminating empty lines and remarks from a source code before compilation?


no one, unless the compiler/assembler preprocessor is very slow...

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2025
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: reducing the source file,removing empty lines etc

Postby charles » Tue Nov 07, 2017 11:53 pm

maybe size , or that's irrelevant?
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
shoggoth
Nature
Nature
Posts: 853
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: reducing the source file,removing empty lines etc

Postby shoggoth » Wed Nov 08, 2017 5:50 am

charles wrote:maybe size , or that's irrelevant?


Remove all blank lines and comments, also make sure to keep variable names as short as possible - preferably single letters only. Avoid loops and consitionals at all cost, and make sure to write all your code as a single function. Function calls are generally bad and may cause bugs anyway.
Ain't no space like PeP-space.

ThorstenOtto
Captain Atari
Captain Atari
Posts: 150
Joined: Sun Aug 03, 2014 5:54 pm

Re: reducing the source file,removing empty lines etc

Postby ThorstenOtto » Wed Nov 08, 2017 5:53 am

There shouldn't be any lines. Good programs always are in a single line only

ijor
Hardware Guru
Hardware Guru
Posts: 3095
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: reducing the source file,removing empty lines etc

Postby ijor » Wed Nov 08, 2017 12:00 pm

Real programmers don't use C (let alone some of the modern blasphemy like Java or Phyton). They only use assembler, and without comments of course.

rockyone
Captain Atari
Captain Atari
Posts: 328
Joined: Thu Jan 20, 2011 8:47 pm
Location: France
Contact:

Re: reducing the source file,removing empty lines etc

Postby rockyone » Wed Nov 08, 2017 1:20 pm

The Basic Omikron compiler stores empty lines and comments in the compiled program.
By removing all that is unnecessary, the size of the compiled program can be significantly reduced.

A baseline is 255 bytes.
Unused octets on a line are compiled, but take up less space than comments.
That's why I made a cleaner.

but I do not know if the GFA compiler does the same.

rockyone
Captain Atari
Captain Atari
Posts: 328
Joined: Thu Jan 20, 2011 8:47 pm
Location: France
Contact:

Re: reducing the source file,removing empty lines etc

Postby rockyone » Wed Nov 08, 2017 1:59 pm

Before cleaning:
Mid-low 96520 bytes, compiler, 91836 bytes

After cleaning:
Low: 58672 bytes, 87732 byte compiler

The gain is not very important with this file, but on a floppy disk, the place is not very big.

it's been a long time since I cleaned up before compiling.
But I did it to give you an idea ...

And if you want to reduce a lot more, fill in the lines as much as you can.
I did it once, I was very surprised at the result.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: reducing the source file,removing empty lines etc

Postby lp » Wed Nov 08, 2017 2:11 pm

rockyone wrote:The Basic Omikron compiler stores empty lines and comments in the compiled program.
By removing all that is unnecessary, the size of the compiled program can be significantly reduced.

A baseline is 255 bytes.
Unused octets on a line are compiled, but take up less space than comments.
That's why I made a cleaner.

I hope you are joking. 8O


but I do not know if the GFA compiler does the same.


The first thing the GFA compiler does is shrink the source by removing all comments and list format lines. This frees more ram for the compiling process. You won't find a single byte wasted on comments. Symbol size has no effect either.

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4844
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: reducing the source file,removing empty lines etc

Postby simonsunnyboy » Wed Nov 08, 2017 4:39 pm

lp wrote:
rockyone wrote:The Basic Omikron compiler stores empty lines and comments in the compiled program.
By removing all that is unnecessary, the size of the compiled program can be significantly reduced.

A baseline is 255 bytes.
Unused octets on a line are compiled, but take up less space than comments.
That's why I made a cleaner.

I hope you are joking. 8O


That was also my thought.

Anyways, removing empty lines made sense in really old interpreters as it sped up executing the relevant code.
A compiler should always discard such, regardless of the language compiled.

So to answer the question: no you will not have benefits, on the contrary, you will probably make reuse of your code a lot harder.
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org

rockyone
Captain Atari
Captain Atari
Posts: 328
Joined: Thu Jan 20, 2011 8:47 pm
Location: France
Contact:

Re: reducing the source file,removing empty lines etc

Postby rockyone » Wed Nov 08, 2017 4:53 pm

Result with the 3.05 Omikron 3.03 compiler
rockyone wrote:Before cleaning:
Mid-low 96520 bytes, compiler, 91836 bytes

After cleaning:
Low: 58672 bytes, 87732 byte compiler


Result with the 4.08 Omikron 3.06 compiler
The file "B", is the one obtained after cleaning
compiler.jpg


In this case, all is compiled. sometimes the comments are readable in the compile file!
Source and compiled files :
REDUC_VA.zip

This version should properly clean LST files created with GFA. (Be careful that there are 'bytes EOF', otherwise there will be no backup.
-----------------------------------
A baseline is 255 bytes.
Unused octets on a line are compiled, but take up less space than comments.
That's why I made a cleaner.

I never tested this with the 4.08 compiler, but I would do it soon with a small file.
You do not have the required permissions to view the files attached to this post.

rockyone
Captain Atari
Captain Atari
Posts: 328
Joined: Thu Jan 20, 2011 8:47 pm
Location: France
Contact:

Re: reducing the source file,removing empty lines etc

Postby rockyone » Wed Nov 08, 2017 5:21 pm

simonsunnyboy wrote:
rockyone wrote:A baseline is 255 bytes.
Unused octets on a line are compiled, but take up less space than comments.
That's why I made a cleaner.


That was also my thought.

Anyways, removing empty lines made sense in really old interpreters as it sped up executing the relevant code.
A compiler should always discard such, regardless of the language compiled.

So to answer the question: no you will not have benefits, on the contrary, you will probably make reuse of your code a lot harder.


Of course, I do not waste my time doing it.

I tested once with the 3.03 compiler is a small file. qaund I realized that comments were not ignored.

And I'm sure it's the same with 4.08.


The advantage of the cleanup is especially for the 3.03 compiler, I guess you know the difficulty it sometimes has to compile large files

rockyone
Captain Atari
Captain Atari
Posts: 328
Joined: Thu Jan 20, 2011 8:47 pm
Location: France
Contact:

Re: reducing the source file,removing empty lines etc

Postby rockyone » Wed Nov 08, 2017 10:39 pm

compiler.jpg

I took the B.bas file and I deleted a lot of empty space. then compile with version 4.08
C.jpg


C.zip
,Now the basic file is incomprehensible!

The Omikron compiler is not the best!

The size of variables, labels ... also interfere with the weight of the files.
You do not have the required permissions to view the files attached to this post.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2025
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: reducing the source file,removing empty lines etc

Postby charles » Wed Nov 08, 2017 11:02 pm

I do appreciate the time and accuracy spent on this topic ...
its a good utility either way ..
its one element noone but rocky has expressed before... I did not know of this ,
too presumptuous to believe this option automatically exist in every compiller.
thank you rocky
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 536
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: reducing the source file,removing empty lines etc

Postby dhedberg » Thu Nov 09, 2017 10:26 pm

charles wrote:I do appreciate the time and accuracy spent on this topic ...
its a good utility either way ..
its one element noone but rocky has expressed before... I did not know of this ,
too presumptuous to believe this option automatically exist in every compiller.
thank you rocky

Well, any compiler worthy its name should parse the source file(s) and build a syntax tree according to the grammar of the language, effectively getting rid of comments or anything else that is not code. Storing comments and white space all the way throughout the compilation process and include it in the executable is... simply nuts.
Daniel, New Beat - http://newbeat.atari.org


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 1 guest