Xojo - Stripping code before building an application… not always

ListBox:

I created a Custom ListBox Class (sLB),
I added a EditCopy MenuHandler, and put code there,
I added a ListBox and set its super to sLB,
After a nap, I Copy the sLB.Copy MenuHandler and Paste it into that window,

I ran the project, tested the Copy MenuItem and it worked fine.

Now, days / month / years later (I forgot), in another window, I set the ListBox super to sLB, tested it and it worked as expected.

After another nap (that is what oldsters are best at), I had a crazy idea: whet if I had the same code two times in my project ? What will happens if I cleared a duplicate from the project, build the application and see what happens on the application footprint (size) ?

Result: the newly created application footprint is smaller than the previous one.

So, this duplicate code is not stripped at stand-alone creation.

FWIW.

PS: if I can make an error once, I can do it twice, thrice or more. I searched and, yes, I’ve done it years ago !
I deleted that EditCopy MenuItem (in another window with a sLB), build a new Stand-Alone and it have a lower footprint (than the two previous one).

Oh, yes, I am talking about a 4KB difference (3 x KB here) in the footprint. And most of you do not care for a difference of some MB, so why do I care for so few KBs ? Sometimes I wonder…

Code stripping is not an exact science. Often the human knows better than the computer. Especially in the case of menu handlers.

stripping is NOT done at the level of “method”

A real shame: I placed three copies of the same code in my project !

Then, I am surprised because Xojo does not remove two of them in the stand alone.

Worst: because I do not know how internally code stripping is done, all I can do is to try to explain the way I found (follow) to duplicate (triplicate) the same code (in the same menu event handler) in a project …

Tsk tsk tsk : not OOP.

Is it really that important to have a 4Kb difference in a 6Meg (average size) executable ? On a 500 GIGABYTES average customer hard disk ? A 4,000 bytes small fish in an ocean of 500,000,000,000 bytes…

It depends on how anal you are… Personally I love to do what I can to make my application footprints smaller.

I was really shocked when I had to update and re-write Shine for 64-Bit, it lost 10mb in weight! Accomplishes the same task, just uses different API, different methods and of course Xojo’s 64-Bit compiler.

[quote=247072:@Sam Rowlands]It depends on how anal you are… Personally I love to do what I can to make my application footprints smaller.

I was really shocked when I had to update and re-write Shine for 64-Bit, it lost 10mb in weight! Accomplishes the same task, just uses different API, different methods and of course Xojo’s 64-Bit compiler.[/quote]

For me, the most important is to complete first a functional and as bug free as possible app.

Then, of course, optimization is an art that can be quite enjoyable. I am impressed by your reported shrinking in 64 bit. Very often it is the opposite.

Sam: yes, I am in that boat.

Michel: I already stated what you wrote. This is in the last paragraph of the original text.

Also: you are correct when you wrote about a fully functional feature as bug free as possible…