News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Execution time

Started by Giuseppe MPO, Aug 02, 2021, 12:33 AM

Previous topic - Next topic

Giuseppe MPO

Hi, just a curiosity.
I have noticed that the same individual instructions have different execution speeds when used within a procedure.
I have noticed that some instructions are even 20% slower within a procedure.

Dompie

hmmmmm strange, the PICprocessor executes all instructions at the speed related to the clock and knows nothing about procedures or anything. And every instruction has the exact same timing every time.
In an ordinary program, the Positron compiler will generate the exact same machine instructions for a given Basic command for the most part.
So obviously more info is needed to understand your problem.

Johan

tumbleweed

Quote from: Dompie on Aug 02, 2021, 07:53 AMIn an ordinary program, the Positron compiler will generate the exact same machine instructions for a given Basic command for the most part.
Because of the banked nature of PIC memory, that might not be true.
Compare the asm output of the two if you want to see what's going on.

Giuseppe MPO

Is not a problem it's just a curiosity,
I noticed this thing and I just wanted to understand why.
For example:

TempSDword = PID32 >> 4

this simple instruction when used within a procedure takes 20% of the time.
The test I did it on a PIC16F1619.
I will try to check the assembler to see the differences.

trastikata

Try adding the following declare to prevent bank crossing:

Declare Auto_Variable_Bank_Cross = On