Stripping objects down to bare bones - Does it help to delete the unused parts?
Hi all,
My program calls up about 8 objects I got from the Object Exchange. But for some of these objects, I might only use one or two methods that do not seem to call up other methods within the object. My question is: when you compile the whole program, does the computer know to strip off the unused parts of code, or does it load up the whole object into the Propeller?
If the compiler does not strip off the unused methods, does it therefore make sense to manually remove the unused code so the objects use up less memory in the Propeller?
thanks,
Mark
My program calls up about 8 objects I got from the Object Exchange. But for some of these objects, I might only use one or two methods that do not seem to call up other methods within the object. My question is: when you compile the whole program, does the computer know to strip off the unused parts of code, or does it load up the whole object into the Propeller?
If the compiler does not strip off the unused methods, does it therefore make sense to manually remove the unused code so the objects use up less memory in the Propeller?
thanks,
Mark
Comments
2) If your program doesn't fit in memory and you are trying to shrink it, then removed unused methods from referenced objects is an excellent way to reduce the memory requirement. If you've got plenty of memory available, why bother?
of the modified object that it has been modified. That way someone grabbing a
quick copy of the same from their library doesn't mistake it for the original.
Even adding your initials to the name isn't a bad idea.. [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
OBC, that's a good idea. I would certainly want to mark any stripped down code to make sure it didn't get "out there" where it might be confused with the real (unstripped) thing.
And Pyro, yours is an excellent idea! If it's possible for Parallax to implement such a feature in their Prop Tool, that would certainly encourage people from feeling like the Propeller might be too small for future expansion. Right now, for my own application, I've only used about half the RAM that's available, but I'm looking down the road at some bells and whistles and the dancing girls to whom I would like to attach all those bells and.... well, it would be nice if something could automatically strip them all bare...
My spin objects, that is.
Nonetheless, as Mike says, if the program fits anyway, why bother? Having the extra stuff in there won't affect performance.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
http://forums.parallax.com/showthread.php?p=751450
There's a dichotomy between code-stripping, dead code removal and so on, and the way the PropTool keeps only one copy of duplicated objects that has to be considered but that doesn't mean it's not possible to remove completely unused methods and code ( whether manually or have the compiler do that ).
Perhaps the real issue is that people tend to take object library code "as is" and use it that way with all the bloat it may bring. It doesn't matter as Mike and Phil say when space isn't a concern, but I've always considered library objects ( not just with the Propeller ) to be taken, saved as my own libraries and pruned to just what I need anyway.
Maybe we just need to be clearer or more explicit that library objects aren't sacrosanct; they are reference designs. That taking them, hacking them about, removing and adding things is nothing to worry over, in fact, something to be encouraged.
Post Edited (hippy) : 9/26/2008 5:53:23 PM GMT