[stella] a quickie

Subject: [stella] a quickie
From: "Andrew Davie" <adavie@xxxxxxxxxxxxxxxxx>
Date: Fri, 29 May 1998 23:54:42 +1000
Further optimization tricks - this time, a pretty simple one.
Often, if you modularise things into subroutines (generally a good idea,
right!!) you have code that might look like this...

        ; blah blah blah
            jsr subroutine
            rts

You can replace the above with a simple...

            jmp subroutine

Let the subroutine itself do the returning for us.  You save one byte
(whoooooo!) but also you gain 8 cycles - 6 as you're not doing the redundant
rts, and 2 because you're jumping instead of jsring.  The general principle:
wherever you see a jsr followed immediately by a rts, you can replace the
pair with a jmp, AND AN EXPLANATORY COMMENT OF WHAT THE HELL YOU'VE DONE!!!!

Enjoy.
A


--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html

Current Thread