Page 1 of 1

for performance of executable

Posted: Mon Jul 01, 2024 7:16 pm
by ertan
Dear Friends,

Which of the lines I marked should be used for more application performance?
Is there any difference between them in terms of performance?

Code: Select all | Expand

#include "Fivewin.ch"

[b]STATIC oDBServer                  <--- for sql[/b]

FUNCTION Main
 LOCAL oApp

 oApp := MyApp():New():Run()

RETURN nil

CLASS MyApp FROM TMdiFrame

[b]DATA oDBServer                    <--- for sql[/b]

ENDCLASS

-----------------------------

CLASS TWindow
.....
[b]DATA oParent                                <---[/b]
.....
ENDCLASS

-------- OR ---------

[b]__objAddData( oMain, "oModule" )  <---[/b]

oMain:oParent := oModule

 
Best regards,
Ertan

Re: for performance of executable

Posted: Mon Jul 01, 2024 7:24 pm
by ertan
Sorry,

Code: Select all | Expand

oChild:oParent := oModule
Best regards,
Ertan

Re: for performance of executable

Posted: Mon Jul 01, 2024 8:33 pm
by ertan
oParent wrong variable name. oWnd == oParent

This is correct code.
Which is correct choice for this two state?

Image

Best regards,
Ertan

Re: for performance of executable

Posted: Mon Jul 01, 2024 9:20 pm
by Enrico Maria Giordano
They are for different purposes. Module level STATIC (ie. a STATIC defined outside any functions) is a single variable that all the functions in the module can see. DATA instance variable is a variable incapsulated inside an object instance (ie. one different variable with the same name for each object instance). You have to choose the right one for your needs not for its performance.

Re: for performance of executable

Posted: Mon Jul 01, 2024 9:22 pm
by ertan
Thank you so much Enrico

Best regards,
Ertan