for performance of executable

for performance of executable

Postby ertan » Mon Jul 01, 2024 7:16 pm

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 view
#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

Postby ertan » Mon Jul 01, 2024 7:24 pm

Sorry,

Code: Select all  Expand view
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

Postby ertan » Mon Jul 01, 2024 8:33 pm

oParent wrong variable name. oWnd == oParent

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

Image

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

Re: for performance of executable

Postby Enrico Maria Giordano » Mon Jul 01, 2024 9:20 pm

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
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: for performance of executable

Postby ertan » Mon Jul 01, 2024 9:22 pm

Thank you so much Enrico

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests