Shop OBEX P1 Docs P2 Docs Learn Events
Asm performance question — Parallax Forums

Asm performance question

max72max72 Posts: 1,155
edited 2009-08-13 11:55 in Propeller 1
Hi have a question concerning ASM performance.
I was testing the atan2 asm routine from Beau Schwabe, with small changes to have also distance.
I tried in the attached test file to check execution time, so I made 3 different versions of the atan routine, progessively shorter.
While the results are not accurate any more, I expected a performance increase.
In fact the execution times are almost identical.
Am I missing a point in the cnt method or in the asm access times?

Thanks in advance,
Massimo

Comments

  • cessnapilotcessnapilot Posts: 182
    edited 2009-08-12 16:01
    Hi maxximo,

    X:= 100_000
    Y:= 200_000

    So the heading result is

    atan(2) = 63.43 degrees

    That is correct, something we should expect from a PASM CORDIC with 20 iterations. (about 15-20 bits correct result), but you mix PASM and SPIN code in the time span. The magnitude of those time differencies are dominated by the time needed for the interpreted SPIN code. The tiny alterations come from PASM, but·I think they are too tiny. Does your code wait for the PASM code to to be finished,· or just reads HUB?

    Cheers,

    Istvan
  • max72max72 Posts: 1,155
    edited 2009-08-12 20:29
    cessnapilot said...

    Does your code wait for the PASM code to to be finished, or just reads HUB?

    Hi Istvan,
    I have a limited understanding of Pasm, and I simply modified an existing code. So I don't know the answer for sure. My guess it Hub access is dominating the routine, but I cannot fit the results with what the manual says.
    In the examples the atan2 code is stripped down to next to nothing and it takes almost the same time, so all the time is spent elsewhere. The full version uses 20 iterations, giving an impessive precision, and there is also the cordic gain correction which does not affect the time required. Is the biggest amount of time spent in the HUB acces, or in the spin part that calls the routine? How can I foresee the requirements and (maybe) improve it?

    Massimo
  • cessnapilotcessnapilot Posts: 182
    edited 2009-08-13 05:44
    Very busy these days, but after a somewhat closer quick look, I see that the PASM code clears it before actually finishing the job, setcommand checks it, and continues the SPIN code. Try to record time inside the PASM code, with something similar that

    MOV counts, CNT
    .
    .Your PASM code does the job here
    .
    SUB tcounts, CNT

    And send back elapsed time in arg4, or so.

    Now I have to continue a poker game with one of those COGs. She (Alice for COG A) learns and adapts to my obviously weak tactics and seems now to beat me soon. In revenge I shell deploy Bob, the Killer (for COG B with a new strategy) to defeat her, while COG D (the Dealer) manages the deck and the table.

    Wish me Luck,


    Cheers,


    Istvan
  • max72max72 Posts: 1,155
    edited 2009-08-13 11:55
    smile.gif

    Have fun!

    Massimo
Sign In or Register to comment.