Subroutine or repeated code, which is more memory efficient?


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Subroutine or repeated code, which is more memory efficient?

    Henrik could give more detailed answer, in the meantime...

    A loop of 2 or 3 is structured but not always smaller in code (especially when short like yours).

    But 30 times, I'd go with a loop.

    You can always compile both ways and check code size (Microcode Studio posts it at the bottom).


    Robert
    Last edited by Demon; - 5th June 2014 at 18:14. Reason: compiler will not generate a loop for you, just repeat the instructions.

Similar Threads

  1. Stopping repeated messages
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th October 2011, 19:40
  2. Making code more efficient, any ideas please?
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th July 2011, 13:28
  3. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  4. Embedding Variables into Code Memory
    By JoeSolar in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th October 2006, 17:58
  5. fatal error [301] out of memory with 4 lines of code????
    By George in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th October 2005, 21:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts