Run assembler routine in a spin program?
prof_braino
Posts: 4,313
A spin program that runs in a single cog a has bottleneck inside the main loop.
Is it possible to optimize just the bottleneck portion in assembly, and still have the remainder of the program in spin, and still run in a single cog?
How does one call the assembly routine from spin? Is there an example of this in the object exchange?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are 10 types of people in the world,
Those who understand binary, and those who don't
Is it possible to optimize just the bottleneck portion in assembly, and still have the remainder of the program in spin, and still run in a single cog?
How does one call the assembly routine from spin? Is there an example of this in the object exchange?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are 10 types of people in the world,
Those who understand binary, and those who don't
Comments
That said, there's a decent chance you may be able to optimize the SPIN itself to make it faster - The compiler makes no attempt to optimize your code. Post the routine in question (attach the code to a reply, for simplicity) and someone may be able to suggest improvements. Assuming it's reasonably close to the goal to begin with.
Jason
Of course - so why do it? One of SPIN's major advantages over many other languages is how easy it makes it to run either a SPIN method or a PASM program concurrently in another cog. If you can redesign your program to take advantage of this parallelism you can partially or completely eliminate this bottleneck. While not all algoritms are amenable to parallelization (is this a word?), most programs can be at least significantly improved.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Dave
"Why?" indeed. Just because, usually. This is a hypothetical situation.
In this case, to a lesser extent, the other cogs might be occupied and/or busy with timing critical functions.
But mostly because I wanted somebody confirm "it can't be done" so I have something to ponder for a while. Thanks Jason.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are 10 types of people in the world,
Those who understand binary, and those who don't