Optimize tricks?
T Chap
Posts: 4,223
Out of ram and a long way from home.
Looking for any suggestions on ways to shrink the binary.
For example, I just learned that using a repeat(n) uses less room that putting the same command multiple times in a row (ie waitcnt).
Also going through all your objects commenting out unused code reduces size.
Post Edited (TChapman) : 5/30/2009 11:07:46 PM GMT
Looking for any suggestions on ways to shrink the binary.
For example, I just learned that using a repeat(n) uses less room that putting the same command multiple times in a row (ie waitcnt).
Also going through all your objects commenting out unused code reduces size.
Post Edited (TChapman) : 5/30/2009 11:07:46 PM GMT
Comments
'Just a few ideas...
-Phil
* If you are using objects from the exchange (or any outside source for that matter), consider saving a modified version where you pare out any functions not used in your application.
* If you can take the speed hit, use Spin instead of PASM (this can include everything from using the Spin Float object instead of the faster PASM one. Also, copying the initialization values for a PASM DAT block to hub RAM before starting a cog (using longmove) so those values get loaded into the cog during the cognew, instead of using par and a bunch of PASM instructions to load in an array of (for example) variable locations).
* always use long/word/bytemove and long/word/bytefill over rolling your own loops
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
Post Edited (lonesock) : 5/30/2009 11:08:15 PM GMT
Other advanced things can be done if you need more Spin code space and have big PASM blocks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Clean? Never heard of it.
It generates temp files with the unused code removed and then compiles that so it should be the some as you deleting the routines
Perhaps an explanation of what you are trying to do may help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
"always use long/word/bytemove and long/word/bytefill over rolling your own loops"
Does this apply to Spin? Not clear on what "rolling my own loops" means:
After manually doing what I could I went from 7850 to 7338 with BST and NO optimizers turned on (folding, deleting unused, etc first 4 options under compiler prefs UNchecked).
Turn on the first 4 optimizers in BST under complier prefs and the result is: 6915.
Run clean in the file, reload clean file into BST without and compile without BST optimizers: 6717
Turn on BST optimizers on the Clean file: 6705
The Clean app seems to work but hangs up each time, errors that maybe 6 files were expected to have unique names. Sometimes it lists a row of longs from my vars, other times a row of words. Not a big deal as it saves the file and the file appears top run fine.
Also, I'm sorry for neglecting to mention it from the get-go. It's just been off my radar for so long, I didn't think of it. Besides, a third party recommendation carries more weight anyway!
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
As you know, you can't have PASM constants using more than 9 bits, so those constants are typically defined as a long and pre-initialized, e.g.:
where in the code it is used:
There are some tricks you can use for cases like this:
So, in summary, in PASM and for certain constant values only, you can get away without defining a constant long, saving you a whopping 4 bytes, yay.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.