Shop OBEX P1 Docs P2 Docs Learn Events
Prop Code Reduction Tips — Parallax Forums

Prop Code Reduction Tips

Vega256Vega256 Posts: 197
edited 2012-06-19 17:35 in Propeller 1
Hey,

I have, yet again, reached that 512 long limit. Video drivers can really tend to hog an excessive amount of memory (at least the ones I've written anyway). Does anyone have any tips for reducing code? Can using self-modifying code, wherever possible, be a memory saver?

Comments

  • KyeKye Posts: 2,200
    edited 2012-06-19 06:52
    Um, you can use variable overlays. So, if only a few of your res variables are in use at once you can alias multiple labels to the same location.

    Also, you can just do things in a more clever way... you'll find that its very much possible to shrink the size of you code by just optimizing how you do things. Unfortunately, this requires you to really understand all the instructions available.

    Thanks,
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-19 17:35
    Your initialisation code can often be reclaimed and used for variables.
    Try and make common code into subroutines.
    You can run overlays (see my overlay object in the obex)
    You can use LMM (~4-5 times slower) by executing from hub (loads into cog and a small loop executes each long fetched - see the LMM thread)

    Post your code, explain what it does, and ask
Sign In or Register to comment.