for performance of executable

Post Reply
User avatar
ertan
Posts: 25
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye

for performance of executable

Post 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
User avatar
ertan
Posts: 25
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye

Re: for performance of executable

Post by ertan »

Sorry,

Code: Select all | Expand

oChild:oParent := oModule
Best regards,
Ertan
User avatar
ertan
Posts: 25
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye

Re: for performance of executable

Post by ertan »

oParent wrong variable name. oWnd == oParent

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

Image

Best regards,
Ertan
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: for performance of executable

Post 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.
User avatar
ertan
Posts: 25
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye

Re: for performance of executable

Post by ertan »

Thank you so much Enrico

Best regards,
Ertan
Post Reply