Procedures - Speedinfo using Shared

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Hi Fred
Is there any speed different when calling a procedure and sharing only 1 or for example 5 or more variables/strings to the procedure?

And what happen (any speed different) when sharing 5 or more variables/strings but inside the procedure i need everytime only one of the shared stuff?

For example:

Code: Select all

    Procedure TempTest(void)
        Shared  tmpa, tmpb, tmpc, tmpd, tmpe, stra$, strb$, strc$ 
        ;
        tmpc = tmpc * 12          ; only tmpc is needed for example!
        ;
    EndProcedure

also is there any speed different to the next example...?

Code: Select all

    Procedure TempTest(void)
        Shared  tmpc
        ;
        tmpc = tmpc * 12          ; only tmpc is needed for example!
        ;
    EndProcedure   
I think that more stuff will be shared (if not needed) if will slow down the innerloop a bit, isnt it? Because i heared that it make no different due fact of the compiler!?

Thanks in advance for any answer!

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

look at the /Commented Code and you found the Difference

Its a long way to the top if you wanna .....CodeGuru
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Hi Rings
As i understand it right, the compiler will generate an asm source / exe where all vals will PUSHED !? So there is no speed difference, right? May be, when i delete not needed PUSH POP regs?

Sorry, but me isnt the x86 asm code guru :wink:

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

There is absolutely NO differences.

Fred - AlphaSND
Post Reply